all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: yew-devel@lists.proxmox.com
Subject: [yew-devel] [PATCH yew-widget-toolkit 3/7] touch: fab: rename on_click to on_activate
Date: Tue, 24 Jun 2025 14:19:21 +0200	[thread overview]
Message-ID: <20250624121925.57056-8-d.csapak@proxmox.com> (raw)
In-Reply-To: <20250624121925.57056-1-d.csapak@proxmox.com>

to be consistent with buttons, etc.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 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<Callback<MouseEvent>>,
+    pub on_activate: Option<Callback<MouseEvent>>,
 }
 
 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<MouseEvent>) -> 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<MouseEvent>) -> 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


  parent reply	other threads:[~2025-06-24 12:19 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-24 12:19 [yew-devel] [PATCH yew-widget-toolkit/yew-widget-toolkit-assets 00/11] various touch fixes Dominik Csapak
2025-06-24 12:19 ` [yew-devel] [PATCH yew-widget-toolkit-assets 1/4] slidable: don't add padding on top and bottom to actions Dominik Csapak
2025-06-24 12:19 ` [yew-devel] [PATCH yew-widget-toolkit-assets 2/4] slidable: set background-color to pwt-color-background for actions Dominik Csapak
2025-06-24 12:19 ` [yew-devel] [PATCH yew-widget-toolkit-assets 3/4] color scheme: add `pwt-default-colors` helper Dominik Csapak
2025-06-24 12:19 ` [yew-devel] [PATCH yew-widget-toolkit-assets 4/4] material: add rounded corners to bottom sheet Dominik Csapak
2025-06-24 12:19 ` [yew-devel] [PATCH yew-widget-toolkit 1/7] touch: gesture detector: introduce `InputEvent` Dominik Csapak
2025-06-24 16:27   ` [yew-devel] applied: " Dietmar Maurer
2025-06-24 12:19 ` [yew-devel] [PATCH yew-widget-toolkit 2/7] touch: gesture detector: implement a touch only mode Dominik Csapak
2025-06-24 12:19 ` Dominik Csapak [this message]
2025-06-24 12:19 ` [yew-devel] [PATCH yew-widget-toolkit 4/7] touch: slidable action: rename on_click to on_activate Dominik Csapak
2025-06-24 12:19 ` [yew-devel] [PATCH yew-widget-toolkit 5/7] touch: slidable action: add css classes property Dominik Csapak
2025-06-24 12:19 ` [yew-devel] [PATCH yew-widget-toolkit 6/7] touch: slidable: add on_tap callback Dominik Csapak
2025-06-24 12:19 ` [yew-devel] [PATCH yew-widget-toolkit 7/7] touch: slidable: cleanup unnecessary macro use Dominik Csapak
2025-06-25  6:57 ` [yew-devel] applied: [PATCH yew-widget-toolkit/yew-widget-toolkit-assets 00/11] various touch fixes Dietmar Maurer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250624121925.57056-8-d.csapak@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=yew-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal