update
This commit is contained in:
@@ -7,7 +7,7 @@ use gpui::{
|
||||
Styled as _, Window, deferred, div, ease_out_quint, px,
|
||||
};
|
||||
use gpui_native_icons::{IconRole, icon};
|
||||
use gpui_native_theme::ActiveTheme as _;
|
||||
use gpui_native_theme::{ActiveTheme as _, Size};
|
||||
|
||||
use crate::common::DismissHandler;
|
||||
use crate::common::v_flex;
|
||||
@@ -128,8 +128,10 @@ impl RenderOnce for Alert {
|
||||
let surface = theme.colors.surface;
|
||||
let border = theme.colors.border;
|
||||
let shadows = theme.elevations.popover.shadows();
|
||||
let text_size = theme.sizes.small.text_size;
|
||||
let icon_size = theme.sizes.small.icon_size;
|
||||
let metrics = theme.sizes.resolve(Size::Medium);
|
||||
let icon_size = metrics.icon_size;
|
||||
let title_size = metrics.text_size;
|
||||
let caption_size = metrics.caption_size;
|
||||
|
||||
div()
|
||||
.w_full()
|
||||
@@ -160,7 +162,7 @@ impl RenderOnce for Alert {
|
||||
.when_some(self.title.clone(), |alert, title| {
|
||||
alert.child(
|
||||
div()
|
||||
.text_size(text_size)
|
||||
.text_size(title_size)
|
||||
.text_color(foreground)
|
||||
.when(self.message.is_some(), |title| {
|
||||
title.font_weight(gpui::FontWeight::SEMIBOLD)
|
||||
@@ -169,13 +171,17 @@ impl RenderOnce for Alert {
|
||||
)
|
||||
})
|
||||
.when_some(self.message.clone(), |alert, message| {
|
||||
// With no title, the message is the primary line.
|
||||
let color = if self.title.is_some() {
|
||||
muted_foreground
|
||||
} else {
|
||||
foreground
|
||||
};
|
||||
alert.child(div().text_size(text_size).text_color(color).child(message))
|
||||
alert.child(
|
||||
div()
|
||||
.text_size(caption_size)
|
||||
.text_color(color)
|
||||
.child(message),
|
||||
)
|
||||
}),
|
||||
)
|
||||
.when_some(self.on_dismiss, |alert, on_dismiss| {
|
||||
@@ -189,7 +195,7 @@ impl RenderOnce for Alert {
|
||||
.hover(|style| style.bg(muted))
|
||||
.child(
|
||||
icon(IconRole::Close)
|
||||
.size(theme.sizes.small.icon_size * 0.75)
|
||||
.size(theme.sizes.small.dense_icon_size)
|
||||
.color(foreground.alpha(0.55)),
|
||||
)
|
||||
.on_click(move |_, _window, cx| on_dismiss(cx)),
|
||||
|
||||
Reference in New Issue
Block a user