feat: replace sidebar row icon with prefix and suffix slots

This commit is contained in:
2026-11-10 07:43:30 +07:00
parent 322f037289
commit fbc4f24d16
4 changed files with 88 additions and 64 deletions
+16 -5
View File
@@ -3739,16 +3739,27 @@ impl Render for SidebarDemo {
cx.notify();
});
})
.entries(|_, _| {
.entries(|_, cx| {
let theme = cx.theme();
let row_icon = || {
icon(IconRole::Folder).size(theme.sizes.medium.icon_size)
};
vec![
SidebarEntry::header("Favorites"),
SidebarEntry::row("Documents").icon(IconRole::Folder),
SidebarEntry::row("Documents").prefix(row_icon()),
SidebarEntry::row("Pictures")
.icon(IconRole::Folder)
.detail("24"),
.prefix(row_icon())
.detail("24")
.suffix(
Badge::new("new").variant(BadgeVariant::Accent),
),
SidebarEntry::row("Archive").disabled(true),
SidebarEntry::header("Locations"),
SidebarEntry::row("iCloud").icon(IconRole::Folder),
SidebarEntry::row("iCloud").prefix(row_icon()).suffix(
StatusDot::new("sidebar-demo-icloud-status")
.small()
.variant(StatusDotVariant::Success),
),
SidebarEntry::row("Trash"),
]
}),