public inbox for yew-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH yew-widget-toolkit 1/2] widget: theme mode selector: add tooltips for the different modes
@ 2026-06-02 11:43 Dominik Csapak
  2026-06-02 11:43 ` [PATCH yew-widget-toolkit 2/2] widget: theme mode selector: use 'fa-desktop' for system theme Dominik Csapak
  0 siblings, 1 reply; 2+ messages in thread
From: Dominik Csapak @ 2026-06-02 11:43 UTC (permalink / raw)
  To: yew-devel

So it's clear which mode is activated currently.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 src/widget/theme_mode_selector.rs | 25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/src/widget/theme_mode_selector.rs b/src/widget/theme_mode_selector.rs
index 78df587..b254108 100644
--- a/src/widget/theme_mode_selector.rs
+++ b/src/widget/theme_mode_selector.rs
@@ -3,7 +3,7 @@ use std::rc::Rc;
 use yew::virtual_dom::{Key, VComp, VNode};
 
 use crate::state::{Theme, ThemeMode};
-use crate::widget::Button;
+use crate::widget::{Button, Tooltip};
 use crate::{impl_class_prop_builder, impl_yew_std_props_builder, prelude::*};
 
 /// Round icon button to select light/dark theme.
@@ -78,15 +78,20 @@ impl Component for PwtThemeModeSelector {
 
         let onclick = ctx.link().callback(|_| Msg::NextMode);
 
-        Button::new_icon(match self.theme {
-            ThemeMode::System => "fa fa-fw fa-asterisk",
-            ThemeMode::Dark => "fa fa-fw fa-moon-o",
-            ThemeMode::Light => "fa fa-fw fa-sun-o",
-        })
-        .class(props.class.clone())
-        .class("circle")
-        .onclick(onclick)
-        .aria_label("Select Theme Mode")
+        let (icon, tip) = match self.theme {
+            ThemeMode::System => ("fa fa-fw fa-asterisk", tr!("System Theme")),
+            ThemeMode::Dark => ("fa fa-fw fa-moon-o", tr!("Dark Mode")),
+            ThemeMode::Light => ("fa fa-fw fa-sun-o", tr!("Light Mode")),
+        };
+
+        Tooltip::new(
+            Button::new_icon(icon)
+                .class(props.class.clone())
+                .class("circle")
+                .onclick(onclick)
+                .aria_label("Select Theme Mode"),
+        )
+        .tip(tip)
         .into()
     }
 
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-06-02 11:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-02 11:43 [PATCH yew-widget-toolkit 1/2] widget: theme mode selector: add tooltips for the different modes Dominik Csapak
2026-06-02 11:43 ` [PATCH yew-widget-toolkit 2/2] widget: theme mode selector: use 'fa-desktop' for system theme Dominik Csapak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal