public inbox for yew-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH yew-widget-toolkit 0/3] navigation drawer improvements
@ 2026-06-18 11:31 Dominik Csapak
  2026-06-18 11:31 ` [PATCH yew-widget-toolkit 1/3] widget: navigation drawer: add optional trailing element for menu items Dominik Csapak
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Dominik Csapak @ 2026-06-18 11:31 UTC (permalink / raw)
  To: yew-devel

* add ability to show an html element after the labe in a menu item
* code cleanup
* typo fix

Dominik Csapak (3):
  widget: navigation drawer: add optional trailing element for menu
    items
  widget: navigation drawer: cleanup menu toggle
  widget: navigation drawer: fix typo in comment

 src/widget/nav/mod.rs               |  5 +++++
 src/widget/nav/navigation_drawer.rs | 11 ++++++-----
 2 files changed, 11 insertions(+), 5 deletions(-)

-- 
2.47.3





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

* [PATCH yew-widget-toolkit 1/3] widget: navigation drawer: add optional trailing element for menu items
  2026-06-18 11:31 [PATCH yew-widget-toolkit 0/3] navigation drawer improvements Dominik Csapak
@ 2026-06-18 11:31 ` Dominik Csapak
  2026-06-18 11:31 ` [PATCH yew-widget-toolkit 2/3] widget: navigation drawer: cleanup menu toggle Dominik Csapak
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Dominik Csapak @ 2026-06-18 11:31 UTC (permalink / raw)
  To: yew-devel

Sometimes it can be useful to show some element after the menu label,
e.g. a button/status indicator/etc. so add a simple html option to the
menu item.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 src/widget/nav/mod.rs               | 5 +++++
 src/widget/nav/navigation_drawer.rs | 2 ++
 2 files changed, 7 insertions(+)

diff --git a/src/widget/nav/mod.rs b/src/widget/nav/mod.rs
index 48283c5..166ad26 100644
--- a/src/widget/nav/mod.rs
+++ b/src/widget/nav/mod.rs
@@ -49,6 +49,11 @@ pub struct MenuItem {
     #[builder_cb(IntoEventCallback, into_event_callback, ())]
     #[prop_or_default]
     pub on_activate: Option<Callback<()>>,
+
+    /// An optional trailing element that comes after the label.
+    #[prop_or_default]
+    #[builder(IntoPropValue, into_prop_value)]
+    pub trailing: Option<Html>,
 }
 
 impl MenuItem {
diff --git a/src/widget/nav/navigation_drawer.rs b/src/widget/nav/navigation_drawer.rs
index 4f28516..0066c78 100644
--- a/src/widget/nav/navigation_drawer.rs
+++ b/src/widget/nav/navigation_drawer.rs
@@ -238,6 +238,8 @@ impl PwtNavigationDrawer {
             )
             // add memu label
             .with_child(html! {<div class="pwt-text-truncate pwt-flex-fill">{&item.label}</div>})
+            // add the optional trailer
+            .with_optional_child(item.trailing.clone())
             // add optional menu-open icon
             .with_optional_child(is_menu.then(|| {
                 Container::from_tag("i")
-- 
2.47.3





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

* [PATCH yew-widget-toolkit 2/3] widget: navigation drawer: cleanup menu toggle
  2026-06-18 11:31 [PATCH yew-widget-toolkit 0/3] navigation drawer improvements Dominik Csapak
  2026-06-18 11:31 ` [PATCH yew-widget-toolkit 1/3] widget: navigation drawer: add optional trailing element for menu items Dominik Csapak
@ 2026-06-18 11:31 ` Dominik Csapak
  2026-06-18 11:32 ` [PATCH yew-widget-toolkit 3/3] widget: navigation drawer: fix typo in comment Dominik Csapak
  2026-06-19  4:58 ` applied: [PATCH yew-widget-toolkit 0/3] navigation drawer improvements Dietmar Maurer
  3 siblings, 0 replies; 5+ messages in thread
From: Dominik Csapak @ 2026-06-18 11:31 UTC (permalink / raw)
  To: yew-devel

some minor cleanup changes:
* use Fa class instead of manual container
* use fixed-width for icon (useful when trailing element is just an icon)
* drop unnecessary trailing non-breaking space

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 src/widget/nav/navigation_drawer.rs | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/widget/nav/navigation_drawer.rs b/src/widget/nav/navigation_drawer.rs
index 0066c78..12b4d1e 100644
--- a/src/widget/nav/navigation_drawer.rs
+++ b/src/widget/nav/navigation_drawer.rs
@@ -16,7 +16,7 @@ use crate::state::{NavigationContext, NavigationContextExt, Selection};
 use crate::{impl_class_prop_builder, impl_yew_std_props_builder};
 
 use crate::dom::focus::roving_tabindex_next;
-use crate::widget::{Column, Container};
+use crate::widget::{Column, Container, Fa};
 
 use super::{Menu, MenuEntry, MenuItem};
 
@@ -242,13 +242,12 @@ impl PwtNavigationDrawer {
             .with_optional_child(item.trailing.clone())
             // add optional menu-open icon
             .with_optional_child(is_menu.then(|| {
-                Container::from_tag("i")
+                Fa::new("caret-down")
+                    .fixed_width()
                     .attribute("role", "none")
-                    .class("fa fa-caret-down")
                     .class("pwt-nav-menu-item-arrow")
                     .class(open.then_some("expanded"))
                     .onclick(ontoggle)
-                    .with_child("\u{00a0}")
             }))
             .into()
     }
-- 
2.47.3





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

* [PATCH yew-widget-toolkit 3/3] widget: navigation drawer: fix typo in comment
  2026-06-18 11:31 [PATCH yew-widget-toolkit 0/3] navigation drawer improvements Dominik Csapak
  2026-06-18 11:31 ` [PATCH yew-widget-toolkit 1/3] widget: navigation drawer: add optional trailing element for menu items Dominik Csapak
  2026-06-18 11:31 ` [PATCH yew-widget-toolkit 2/3] widget: navigation drawer: cleanup menu toggle Dominik Csapak
@ 2026-06-18 11:32 ` Dominik Csapak
  2026-06-19  4:58 ` applied: [PATCH yew-widget-toolkit 0/3] navigation drawer improvements Dietmar Maurer
  3 siblings, 0 replies; 5+ messages in thread
From: Dominik Csapak @ 2026-06-18 11:32 UTC (permalink / raw)
  To: yew-devel

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 src/widget/nav/navigation_drawer.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/widget/nav/navigation_drawer.rs b/src/widget/nav/navigation_drawer.rs
index 12b4d1e..89b4b4b 100644
--- a/src/widget/nav/navigation_drawer.rs
+++ b/src/widget/nav/navigation_drawer.rs
@@ -236,7 +236,7 @@ impl PwtNavigationDrawer {
                     |icon| html! { <i class={classes!(icon.to_string(), "pwt-nav-menu-icon")}/>},
                 ),
             )
-            // add memu label
+            // add menu label
             .with_child(html! {<div class="pwt-text-truncate pwt-flex-fill">{&item.label}</div>})
             // add the optional trailer
             .with_optional_child(item.trailing.clone())
-- 
2.47.3





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

* applied: [PATCH yew-widget-toolkit 0/3] navigation drawer improvements
  2026-06-18 11:31 [PATCH yew-widget-toolkit 0/3] navigation drawer improvements Dominik Csapak
                   ` (2 preceding siblings ...)
  2026-06-18 11:32 ` [PATCH yew-widget-toolkit 3/3] widget: navigation drawer: fix typo in comment Dominik Csapak
@ 2026-06-19  4:58 ` Dietmar Maurer
  3 siblings, 0 replies; 5+ messages in thread
From: Dietmar Maurer @ 2026-06-19  4:58 UTC (permalink / raw)
  To: Dominik Csapak, yew-devel

applied

On 6/18/26 1:32 PM, Dominik Csapak wrote:
> * add ability to show an html element after the labe in a menu item
> * code cleanup
> * typo fix
>
> Dominik Csapak (3):
>    widget: navigation drawer: add optional trailing element for menu
>      items
>    widget: navigation drawer: cleanup menu toggle
>    widget: navigation drawer: fix typo in comment
>
>   src/widget/nav/mod.rs               |  5 +++++
>   src/widget/nav/navigation_drawer.rs | 11 ++++++-----
>   2 files changed, 11 insertions(+), 5 deletions(-)
>




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

end of thread, other threads:[~2026-06-19  4:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-18 11:31 [PATCH yew-widget-toolkit 0/3] navigation drawer improvements Dominik Csapak
2026-06-18 11:31 ` [PATCH yew-widget-toolkit 1/3] widget: navigation drawer: add optional trailing element for menu items Dominik Csapak
2026-06-18 11:31 ` [PATCH yew-widget-toolkit 2/3] widget: navigation drawer: cleanup menu toggle Dominik Csapak
2026-06-18 11:32 ` [PATCH yew-widget-toolkit 3/3] widget: navigation drawer: fix typo in comment Dominik Csapak
2026-06-19  4:58 ` applied: [PATCH yew-widget-toolkit 0/3] navigation drawer improvements Dietmar Maurer

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