feat: apply declarative render rule across components

This commit is contained in:
2026-11-10 08:04:24 +07:00
parent fbc4f24d16
commit 44abaf47a9
12 changed files with 545 additions and 561 deletions
+25 -24
View File
@@ -1044,30 +1044,31 @@ fn render_pane(
tabs.iter()
.map(|tab| {
let mut entry = Tab::new(tab.panel.clone(), tab.title.clone());
if let Some(icon) = tab.icon.clone() {
entry = entry.lead(icon.size(metrics.icon_size));
}
entry.closeable(true).wrap({
let panel = tab.panel.clone();
let title = tab.title.clone();
move |tab| {
tab.on_drag(
PanelDrag {
panel: panel.clone(),
},
{
let title = title.clone();
move |_, _, _, cx| {
cx.new(|_| DragPreview {
title: title.clone(),
})
}
},
)
.into_any_element()
}
})
Tab::new(tab.panel.clone(), tab.title.clone())
.when_some(tab.icon.clone(), |entry, icon| {
entry.lead(icon.size(metrics.icon_size))
})
.closeable(true)
.wrap({
let panel = tab.panel.clone();
let title = tab.title.clone();
move |tab| {
tab.on_drag(
PanelDrag {
panel: panel.clone(),
},
{
let title = title.clone();
move |_, _, _, cx| {
cx.new(|_| DragPreview {
title: title.clone(),
})
}
},
)
.into_any_element()
}
})
})
.collect()
}