Unify theme sizing and spacing on Base UI metrics
- Read only mode, accent, accessibility, and native window material from the OS. - Replace platform palettes, metrics, type ramps, borders, and elevations with unified tokens. - Align controls, overlays, and data rows with Base UI sizing.
This commit is contained in:
@@ -11,7 +11,7 @@ use gpui::{
|
||||
div, relative,
|
||||
};
|
||||
use gpui_native_icons::{Icon, IconRole, icon};
|
||||
use gpui_native_theme::{ActiveTheme as _, BORDER_WIDTH, Size};
|
||||
use gpui_native_theme::{ActiveTheme as _, Size};
|
||||
use gpui_native_utils::{focus_handle, focus_ring};
|
||||
|
||||
use crate::button::ButtonVariant;
|
||||
@@ -186,7 +186,6 @@ impl RenderOnce for DropdownMenu {
|
||||
let radius = theme.radius.control;
|
||||
|
||||
let ring = colors.ring;
|
||||
let show_border = theme.borders.buttons && self.variant != ButtonVariant::Ghost;
|
||||
|
||||
let (panel_chrome, enter_duration) = MenuChrome::read(cx);
|
||||
let (background, foreground, hover, pressed) = match self.variant {
|
||||
@@ -197,10 +196,10 @@ impl RenderOnce for DropdownMenu {
|
||||
ramps.primary.pressed,
|
||||
),
|
||||
ButtonVariant::Secondary => (
|
||||
Some(colors.secondary),
|
||||
colors.secondary_foreground,
|
||||
ramps.secondary.hover,
|
||||
ramps.secondary.pressed,
|
||||
Some(colors.surface),
|
||||
colors.foreground,
|
||||
colors.muted,
|
||||
colors.muted_hover,
|
||||
),
|
||||
ButtonVariant::Ghost => (
|
||||
None,
|
||||
@@ -216,10 +215,11 @@ impl RenderOnce for DropdownMenu {
|
||||
),
|
||||
};
|
||||
|
||||
let border = if show_border {
|
||||
colors.border
|
||||
} else {
|
||||
background.unwrap_or_else(gpui::transparent_black)
|
||||
let border = match self.variant {
|
||||
ButtonVariant::Primary => ramps.primary.base,
|
||||
ButtonVariant::Secondary => colors.border,
|
||||
ButtonVariant::Ghost => gpui::transparent_black(),
|
||||
ButtonVariant::Destructive => ramps.destructive.base,
|
||||
};
|
||||
|
||||
let split = self.on_click.is_some();
|
||||
@@ -269,11 +269,7 @@ impl RenderOnce for DropdownMenu {
|
||||
.role(Role::Button)
|
||||
.when_some(a11y_label, |zone, label| zone.aria_label(label))
|
||||
.aria_expanded(self.open)
|
||||
.px(if split && self.icon.is_none() {
|
||||
metrics.padding_x
|
||||
} else {
|
||||
metrics.dense_padding_x
|
||||
})
|
||||
.px(metrics.padding_x)
|
||||
.when(split, |zone| zone.rounded_l(radius))
|
||||
.when(!split, |zone| {
|
||||
zone.rounded(radius)
|
||||
@@ -375,7 +371,7 @@ impl RenderOnce for DropdownMenu {
|
||||
);
|
||||
|
||||
let trigger = h_flex()
|
||||
.h(metrics.control_height + BORDER_WIDTH * 2.0)
|
||||
.h(metrics.control_height)
|
||||
.rounded(radius)
|
||||
.border_1()
|
||||
.border_color(border)
|
||||
|
||||
Reference in New Issue
Block a user