This commit is contained in:
2026-10-23 09:09:19 +07:00
parent c3c8142f06
commit 1c00bc7956
8 changed files with 39 additions and 42 deletions
+7 -8
View File
@@ -19,7 +19,7 @@ pub struct Nav {
suffix: Option<AnyElement>,
selected: bool,
clickable: bool,
gap: bool,
center_prefix: bool,
#[allow(clippy::type_complexity)]
on_click: Option<Rc<dyn Fn(&ClickEvent, &mut Window, &mut App)>>,
}
@@ -39,7 +39,7 @@ impl Nav {
suffix: None,
selected: false,
clickable: false,
gap: true,
center_prefix: false,
on_click: None,
}
}
@@ -50,9 +50,9 @@ impl Nav {
self
}
/// Whether to space the row's contents apart.
pub fn gap(mut self, gap: bool) -> Self {
self.gap = gap;
/// Whether to center the prefix in the avatar-width column.
pub fn center_prefix(mut self, center: bool) -> Self {
self.center_prefix = center;
self
}
@@ -115,14 +115,13 @@ impl RenderOnce for Nav {
.h_8()
.w_full()
.px_2()
.when(self.gap, |this| this.gap_2())
.gap_2()
.rounded(cx.theme().radius)
.when_some(self.prefix, |this, prefix| {
this.child(
h_flex()
.w_6()
.flex_shrink_0()
.justify_center()
.when(self.center_prefix, |this| this.w_6().justify_center())
.child(prefix),
)
})