From: Dominik Csapak <d.csapak@proxmox.com>
To: yew-devel@lists.proxmox.com
Subject: [PATCH yew-widget-toolkit 1/2] widget: theme mode selector: add tooltips for the different modes
Date: Tue, 2 Jun 2026 13:43:18 +0200 [thread overview]
Message-ID: <20260602114323.2258590-1-d.csapak@proxmox.com> (raw)
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
next reply other threads:[~2026-06-02 11:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-02 11:43 Dominik Csapak [this message]
2026-06-02 11:43 ` [PATCH yew-widget-toolkit 2/2] widget: theme mode selector: use 'fa-desktop' for system theme Dominik Csapak
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=20260602114323.2258590-1-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox