Tokenize remaining component layout metrics

- Add combobox, alert edge, and code gutter tokens.
- Replace rem-derived literals in alert, combobox, code, and diff.
This commit is contained in:
2026-11-16 18:35:43 +07:00
parent 1dafa87bef
commit 2c92f26e20
6 changed files with 30 additions and 14 deletions
+9 -2
View File
@@ -9,7 +9,8 @@ use gpui::{
};
use gpui_native_icons::{Icon, IconRole};
use gpui_native_theme::{
ALERT_STACK_WIDTH, ActiveTheme as _, ENTER_SLIDE_DISTANCE, Size, TextRole, Typeset as _,
ALERT_EDGE_WIDTH, ALERT_STACK_WIDTH, ActiveTheme as _, ENTER_SLIDE_DISTANCE, Size, TextRole,
Typeset as _,
};
use gpui_native_utils::ResultLogErr as _;
@@ -228,7 +229,13 @@ impl RenderOnce for Alert {
.overflow_hidden()
.bg(ramp.subtle)
.refine_style(&self.style)
.child(div().flex_none().w_1p5().self_stretch().bg(ramp.base))
.child(
div()
.flex_none()
.w(ALERT_EDGE_WIDTH)
.self_stretch()
.bg(ramp.base),
)
.child(
div()
.flex_1()
+4 -4
View File
@@ -17,7 +17,7 @@ use gpui::{
};
use gpui_native_icons::{IconRole, icon};
use gpui_native_theme::ActiveTheme as _;
use gpui_native_theme::{POPUP_MAX_HEIGHT, Size};
use gpui_native_theme::{COMBOBOX_MIN_WIDTH, COMBOBOX_WIDTH, POPUP_MAX_HEIGHT, Size};
use gpui_native_utils::ResultLogErr as _;
use crate::common::{OVERLAY_LAYER, Sizable, StyledExt as _, h_flex, v_flex};
@@ -531,8 +531,8 @@ where
.id(id.clone())
.key_context(COMBOBOX_CONTEXT)
.relative()
.w(window.rem_size() * 12.0)
.min_w(window.rem_size() * 6.0)
.w(COMBOBOX_WIDTH)
.min_w(COMBOBOX_MIN_WIDTH)
.refine_style(&self.style)
.role(Role::ComboBox)
.aria_expanded(open)
@@ -682,7 +682,7 @@ where
let popup_width = wrapper_bounds
.borrow()
.map(|bounds| bounds.size.width)
.unwrap_or_else(|| window.rem_size() * 12.0);
.unwrap_or(COMBOBOX_WIDTH);
let panel = v_flex()
.id((id.clone(), "panel"))