chore: drop tab icon in favor of lead

This commit is contained in:
2026-11-10 07:17:23 +07:00
parent dc2c612cff
commit 322f037289
4 changed files with 40 additions and 34 deletions
+5 -29
View File
@@ -10,7 +10,7 @@ use gpui_native_core::button::{Button, ButtonVariant};
use gpui_native_core::common::Sizable as _;
use gpui_native_core::spinner::Spinner;
use gpui_native_core::tooltip::Tooltip;
use gpui_native_icons::{Icon, IconRole};
use gpui_native_icons::IconRole;
use gpui_native_theme::{ActiveTheme as _, Size};
use gpui_native_utils::adjacent_selectable;
@@ -35,7 +35,6 @@ pub struct Tab {
/// The stable identity for element state; must survive reordering.
key: ElementId,
label: SharedString,
icon: Option<Icon>,
lead: Option<AnyElement>,
busy: bool,
disabled: bool,
@@ -53,7 +52,6 @@ impl Tab {
Self {
key: key.into(),
label: label.into(),
icon: None,
lead: None,
busy: false,
disabled: false,
@@ -62,16 +60,7 @@ impl Tab {
}
}
/// Shows an icon leading the label.
pub fn icon<I>(mut self, icon: I) -> Self
where
I: Into<Icon>,
{
self.icon = Some(icon.into());
self
}
/// Sets the leading element.
/// Sets the leading element, e.g. an icon or an avatar.
pub fn lead<E>(mut self, lead: E) -> Self
where
E: IntoElement + 'static,
@@ -346,22 +335,9 @@ fn render_tab(
}),
};
let lead = tab.lead.take();
let icon = tab.icon.take();
strip_tab = match lead {
Some(lead) => strip_tab.child(lead),
None => match variant {
TabsVariant::Underline => {
strip_tab.child(div().flex_none().pb_0p5().when_some(icon, |slot, icon| {
slot.child(icon.size(metrics.dense_icon_size).color(label_color))
}))
}
TabsVariant::Pill => strip_tab.when_some(icon, |strip_tab, icon| {
strip_tab.child(icon.size(metrics.dense_icon_size).color(label_color))
}),
},
};
if let Some(lead) = tab.lead.take() {
strip_tab = strip_tab.child(lead);
}
strip_tab = strip_tab.child(tab.label.clone());