layout: replace panel icon with lead element and optional title

This commit is contained in:
2026-11-11 16:26:47 +07:00
parent a0ede5e15a
commit 9326fca63d
5 changed files with 282 additions and 214 deletions
+3 -2
View File
@@ -36,11 +36,12 @@ impl Render for SidePanel {
}
fn descriptor(tag: &'static str) -> PanelDescriptor {
PanelDescriptor::new(tag, tag, move |_, cx| cx.new(|_| Panel { tag }).into())
PanelDescriptor::new(tag, move |_, cx| cx.new(|_| Panel { tag }).into()).title(tag)
}
fn descriptor_with_right_sidebar(tag: &'static str) -> PanelDescriptor {
PanelDescriptor::new(tag, tag, move |_, cx| cx.new(|_| Panel { tag }).into())
PanelDescriptor::new(tag, move |_, cx| cx.new(|_| Panel { tag }).into())
.title(tag)
.right_sidebar(move |_, cx| cx.new(|_| SidePanel { tag }).into())
}
+6 -6
View File
@@ -392,15 +392,15 @@ mod tabbar_toggles {
let dock = cx.update(|cx| {
let dock = DockState::new(cx);
dock.update(cx, |dock, _| {
dock.register_panel(PanelDescriptor::new("one", "One", |_, cx| {
cx.new(|_| DockPanel).into()
}));
dock.register_panel(
PanelDescriptor::new("one", |_, cx| cx.new(|_| DockPanel).into()).title("One"),
);
for index in 0..14 {
let tag = format!("panel-{index}");
let id = tag.clone();
dock.register_panel(PanelDescriptor::new(id, tag, |_, cx| {
cx.new(|_| DockPanel).into()
}));
dock.register_panel(
PanelDescriptor::new(id, |_, cx| cx.new(|_| DockPanel).into()).title(tag),
);
}
});
dock
+1 -1
View File
@@ -22,7 +22,7 @@ impl Render for Panel {
}
fn descriptor(tag: &'static str) -> PanelDescriptor {
PanelDescriptor::new(tag, tag, move |_, cx| cx.new(|_| Panel { tag }).into())
PanelDescriptor::new(tag, move |_, cx| cx.new(|_| Panel { tag }).into()).title(tag)
}
struct Harness {