forked from reya/gpui-native-kit
feat: replace sidebar row icon with prefix and suffix slots
This commit is contained in:
@@ -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"),
|
||||
]
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user