Use shared theme tokens across components
- Replace remaining raw component metrics with theme constants. - Share disabled opacity, focus ring alpha, and code line height. - Route editor borders, weights, and links through the theme. - Align tab, alert, toast, panel, and resize spacing.
This commit is contained in:
@@ -8,11 +8,13 @@ use gpui::prelude::FluentBuilder;
|
||||
use gpui::{
|
||||
AnyElement, App, ElementId, FocusHandle, InteractiveElement as _, IntoElement, KeyDownEvent,
|
||||
ParentElement as _, Pixels, RenderOnce, Role, SharedString, StatefulInteractiveElement as _,
|
||||
StyleRefinement, Styled as _, Window, div, px,
|
||||
StyleRefinement, Styled as _, Window, div,
|
||||
};
|
||||
use gpui_native_core::grain::grain as grain_overlay;
|
||||
use gpui_native_core::scroll_area::ScrollArea;
|
||||
use gpui_native_theme::{ActiveTheme as _, BORDER_WIDTH, TextRole, Typeset as _};
|
||||
use gpui_native_theme::{
|
||||
ActiveTheme as _, BORDER_WIDTH, SIDEBAR_DEFAULT_WIDTH, TextRole, Typeset as _,
|
||||
};
|
||||
use gpui_native_utils::{StyledExt as _, nav_key, paint_selectable_row, selectable_label_color};
|
||||
|
||||
/// The change reporter, fired with the next selected row by pointer and keys.
|
||||
@@ -160,7 +162,7 @@ impl Sidebar {
|
||||
grain: false,
|
||||
border_right: true,
|
||||
padded: true,
|
||||
width: px(240.0),
|
||||
width: SIDEBAR_DEFAULT_WIDTH,
|
||||
a11y_label: None,
|
||||
on_change: None,
|
||||
entries: None,
|
||||
|
||||
@@ -16,7 +16,7 @@ use gpui_native_core::scroll_area::{ScrollArea, ScrollAxes};
|
||||
use gpui_native_core::spinner::Spinner;
|
||||
use gpui_native_core::tooltip::Tooltip;
|
||||
use gpui_native_icons::IconRole;
|
||||
use gpui_native_theme::{ActiveTheme as _, POPUP_MAX_HEIGHT, Size};
|
||||
use gpui_native_theme::{ActiveTheme as _, POPUP_MAX_HEIGHT, Size, TAB_INDICATOR_WIDTH};
|
||||
use gpui_native_utils::{StyledExt as _, adjacent_selectable};
|
||||
|
||||
/// Reports the next selected tab by pointer and keys.
|
||||
@@ -609,7 +609,7 @@ impl Tabs {
|
||||
})
|
||||
.flex()
|
||||
.items_center()
|
||||
.gap_1p5()
|
||||
.gap_2()
|
||||
.cursor_pointer()
|
||||
.role(Role::Tab)
|
||||
.aria_selected(selected)
|
||||
@@ -624,7 +624,7 @@ impl Tabs {
|
||||
.py_1()
|
||||
.rounded_tl(theme.radius.sm)
|
||||
.rounded_tr(theme.radius.sm)
|
||||
.border_b_2()
|
||||
.border_b(TAB_INDICATOR_WIDTH)
|
||||
.border_color(gpui::transparent_black())
|
||||
.when(active, |chip| chip.border_color(theme.ramps.primary.base)),
|
||||
TabsVariant::Pill => chip
|
||||
@@ -1019,7 +1019,7 @@ impl Tab {
|
||||
})
|
||||
.flex()
|
||||
.items_center()
|
||||
.gap_1p5()
|
||||
.gap_2()
|
||||
.role(Role::Tab)
|
||||
.aria_selected(selected)
|
||||
.text_color(label_color)
|
||||
@@ -1033,7 +1033,7 @@ impl Tab {
|
||||
.py_1()
|
||||
.rounded_tl(theme.radius.sm)
|
||||
.rounded_tr(theme.radius.sm)
|
||||
.border_b_2()
|
||||
.border_b(TAB_INDICATOR_WIDTH)
|
||||
.border_color(gpui::transparent_black())
|
||||
.when(active, |strip_tab| {
|
||||
strip_tab.border_color(theme.ramps.primary.base)
|
||||
@@ -1072,9 +1072,9 @@ impl Tab {
|
||||
div()
|
||||
.absolute()
|
||||
.left_0()
|
||||
.top(px(2.0))
|
||||
.bottom(px(2.0))
|
||||
.w(px(2.0))
|
||||
.top(TAB_INDICATOR_WIDTH)
|
||||
.bottom(TAB_INDICATOR_WIDTH)
|
||||
.w(TAB_INDICATOR_WIDTH)
|
||||
.rounded(theme.radius.sm)
|
||||
.bg(theme.ramps.primary.base),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user