From b61ac643dbb0e9ea0362ac717728475a3a12ba84 Mon Sep 17 00:00:00 2001 From: Ren Amamiya Date: Fri, 9 Oct 2026 21:29:49 +0700 Subject: [PATCH] use theme border color for dialog cards --- crates/ui/src/dialog.rs | 32 +++++++++++++------------------- crates/ui/src/nav.rs | 2 +- 2 files changed, 14 insertions(+), 20 deletions(-) diff --git a/crates/ui/src/dialog.rs b/crates/ui/src/dialog.rs index 178e008f..cc0b481a 100644 --- a/crates/ui/src/dialog.rs +++ b/crates/ui/src/dialog.rs @@ -6,7 +6,7 @@ use gpui::{ Pixels, RenderOnce, SharedString, StyleRefinement, Styled, Window, div, px, transparent_black, }; use gpui_base::{DialogBackdrop, DialogPopup, DialogTitle}; -use theme::{ActiveTheme, SCRIM_ALPHA_DARK, hairline, scrim, surface_radius, surface_shadows}; +use theme::{ActiveTheme, SCRIM_ALPHA_DARK, scrim, surface_radius, surface_shadows}; use crate::button::{Button, ButtonCustomVariant, ButtonVariant, ButtonVariants as _}; use crate::motion::DIALOG_IN; @@ -276,18 +276,16 @@ impl RenderOnce for Dialog { .when(self.overlay_visible, |this| { this.bg(scrim(SCRIM_ALPHA_DARK)) }) - .with_animation( - "fade-in", - DIALOG_IN.animation(), - move |this, delta| this.opacity(delta), - ); + .with_animation("fade-in", DIALOG_IN.animation(), move |this, delta| { + this.opacity(delta) + }); let card = DialogPopup::new() .flex() .flex_col() .bg(cx.theme().surface_dialog) .border_1() - .border_color(hairline(0.4)) + .border_color(cx.theme().border) .rounded(px(surface_radius())) .when(cx.theme().shadow, |this| this.shadow(surface_shadows())) .min_h_24() @@ -370,18 +368,14 @@ impl RenderOnce for Dialog { .children(footer(render_ok, render_cancel, window, cx)), ) }) - .with_animation( - "slide-down", - DIALOG_IN.animation(), - move |this, delta| { - let y_offset = px(2.) * (delta - 1.); - let mut shadow = surface_shadows(); - for shadow in &mut shadow { - shadow.color.a *= delta; - } - this.top(y_offset).shadow(shadow) - }, - ); + .with_animation("slide-down", DIALOG_IN.animation(), move |this, delta| { + let y_offset = px(2.) * (delta - 1.); + let mut shadow = surface_shadows(); + for shadow in &mut shadow { + shadow.color.a *= delta; + } + this.top(y_offset).shadow(shadow) + }); gpui_base::Dialog::new(cx) .layer(layer_ix, is_topmost) diff --git a/crates/ui/src/nav.rs b/crates/ui/src/nav.rs index cb8422fe..5ce61197 100644 --- a/crates/ui/src/nav.rs +++ b/crates/ui/src/nav.rs @@ -109,7 +109,7 @@ impl RenderOnce for Nav { cx.theme().text_muted }; - v_flex().h_10().w_full().items_center().child( + v_flex().h_10().w_full().justify_center().child( h_flex() .id(self.id) .h_9()