From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id B84281FF16F for ; Tue, 24 Jun 2025 14:19:26 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 0D7E83686C; Tue, 24 Jun 2025 14:20:01 +0200 (CEST) From: Dominik Csapak To: yew-devel@lists.proxmox.com Date: Tue, 24 Jun 2025 14:19:21 +0200 Message-Id: <20250624121925.57056-8-d.csapak@proxmox.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250624121925.57056-1-d.csapak@proxmox.com> References: <20250624121925.57056-1-d.csapak@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.022 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [yew-devel] [PATCH yew-widget-toolkit 3/7] touch: fab: rename on_click to on_activate X-BeenThere: yew-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Yew framework devel list at Proxmox List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Yew framework devel list at Proxmox Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: yew-devel-bounces@lists.proxmox.com Sender: "yew-devel" to be consistent with buttons, etc. Signed-off-by: Dominik Csapak --- src/touch/fab.rs | 18 +++++++++--------- src/touch/fab_menu.rs | 25 ++++++++++++------------- 2 files changed, 21 insertions(+), 22 deletions(-) diff --git a/src/touch/fab.rs b/src/touch/fab.rs index 1cf06ec..72637c7 100644 --- a/src/touch/fab.rs +++ b/src/touch/fab.rs @@ -4,7 +4,7 @@ use yew::html::{IntoEventCallback, IntoPropValue}; use yew::prelude::*; use yew::virtual_dom::{Key, VComp, VNode}; -use crate::props::{AsClassesMut, EventSubscriber, WidgetBuilder}; +use crate::props::{AsClassesMut, WidgetBuilder}; use crate::widget::Button; /// Favorite action button. @@ -31,7 +31,7 @@ pub struct Fab { /// Click callback #[prop_or_default] - pub on_click: Option>, + pub on_activate: Option>, } impl AsClassesMut for Fab { @@ -104,9 +104,9 @@ impl Fab { self.text = text.into_prop_value(); } - /// Builder style method to set the on_click callback. - pub fn on_click(mut self, cb: impl IntoEventCallback) -> Self { - self.on_click = cb.into_event_callback(); + /// Builder style method to set the on_activate callback. + pub fn on_activate(mut self, cb: impl IntoEventCallback) -> Self { + self.on_activate = cb.into_event_callback(); self } } @@ -141,11 +141,11 @@ impl Component for PwtFab { button .class(class) .attribute("style", props.style.clone()) - .onclick(Callback::from({ - let on_click = props.on_click.clone(); + .on_activate(Callback::from({ + let on_activate = props.on_activate.clone(); move |event: MouseEvent| { - if let Some(on_click) = &on_click { - on_click.emit(event); + if let Some(on_activate) = &on_activate { + on_activate.emit(event); } } })) diff --git a/src/touch/fab_menu.rs b/src/touch/fab_menu.rs index afa48bb..4ad1234 100644 --- a/src/touch/fab_menu.rs +++ b/src/touch/fab_menu.rs @@ -204,7 +204,7 @@ impl Component for PwtFabMenu { let main_button = Fab::new(main_icon_class) .class(props.main_button_class.clone()) - .on_click(ctx.link().callback(|_| Msg::Toggle)); + .on_activate(ctx.link().callback(|_| Msg::Toggle)); container.add_child(main_button); @@ -213,20 +213,19 @@ impl Component for PwtFabMenu { log::error!("FabMenu only supports 5 child buttons."); break; } - let orig_on_click = child.on_click.clone(); + let orig_on_activate = child.on_activate.clone(); let link = ctx.link().clone(); - let child_button = - child - .clone() - .small() - .class("pwt-fab-menu-item") - .on_click(move |event| { - link.send_message(Msg::Toggle); - if let Some(on_click) = &orig_on_click { - on_click.emit(event); - } - }); + let child_button = child + .clone() + .small() + .class("pwt-fab-menu-item") + .on_activate(move |event| { + link.send_message(Msg::Toggle); + if let Some(on_activate) = &orig_on_activate { + on_activate.emit(event); + } + }); container.add_child(child_button); } -- 2.39.5 _______________________________________________ yew-devel mailing list yew-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/yew-devel