From: Dominik Csapak Date: Wed, 20 Dec 2023 11:32:10 +0000 (+0100) Subject: tooltip: rustfmt X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=1cd184a5186e3b364f0de94a2af5e8abeea101f7;p=ui%2Fproxmox-yew-widget-toolkit.git tooltip: rustfmt Signed-off-by: Dominik Csapak --- diff --git a/src/widget/tooltip.rs b/src/widget/tooltip.rs index e39a113..cf9d0c9 100644 --- a/src/widget/tooltip.rs +++ b/src/widget/tooltip.rs @@ -24,7 +24,9 @@ pub struct Tooltip { impl Tooltip { pub fn new(content: impl Into) -> Self { - yew::props!(Self { content: content.into() }) + yew::props!(Self { + content: content.into() + }) } /// Builder style method to set the tooltip @@ -36,7 +38,7 @@ impl Tooltip { /// Method to set the tooltip pub fn set_tip(&mut self, tip: impl IntoPropValue>) { self.rich = false; - self.tip = tip.into_prop_value().map(|tip| html!{{tip}}); + self.tip = tip.into_prop_value().map(|tip| html! {{tip}}); } /// Builder style method to set the tooltip (rich style) @@ -122,26 +124,25 @@ impl Component for PwtTooltip { let show_tooltip = self.show && ctx.props().tip.is_some(); - let content = - Container::new() - .class("pwt-flex-fill-first-child") - .class("pwt-d-flex") - .with_std_props(&props.std_props) - .listeners(&props.listeners) - .with_child(props.content.clone()) - .onmouseenter(ctx.link().callback(|_| Msg::Show)) - .onmouseleave(ctx.link().callback(|_| Msg::Hide)) - .onfocus(ctx.link().callback(|_| Msg::Show)) - .onblur(ctx.link().callback(|_| Msg::Hide)) - .onkeydown(Callback::from({ - let link = ctx.link().clone(); - move |event: KeyboardEvent| { - if show_tooltip && event.key() == "Escape" { - link.send_message(Msg::Hide); - event.prevent_default(); - } + let content = Container::new() + .class("pwt-flex-fill-first-child") + .class("pwt-d-flex") + .with_std_props(&props.std_props) + .listeners(&props.listeners) + .with_child(props.content.clone()) + .onmouseenter(ctx.link().callback(|_| Msg::Show)) + .onmouseleave(ctx.link().callback(|_| Msg::Hide)) + .onfocus(ctx.link().callback(|_| Msg::Show)) + .onblur(ctx.link().callback(|_| Msg::Hide)) + .onkeydown(Callback::from({ + let link = ctx.link().clone(); + move |event: KeyboardEvent| { + if show_tooltip && event.key() == "Escape" { + link.send_message(Msg::Hide); + event.prevent_default(); } - })); + } + })); let tip = Container::new() .node_ref(self.tooltip_ref.clone())