migrate ui crate to new theme tokens
This commit is contained in:
@@ -41,10 +41,10 @@ pub enum NotificationKind {
|
||||
impl NotificationKind {
|
||||
fn icon(&self, cx: &App) -> Icon {
|
||||
let (name, color) = match self {
|
||||
Self::Info => (IconName::Info, cx.theme().icon),
|
||||
Self::Success => (IconName::CheckCircle, cx.theme().icon_accent),
|
||||
Self::Warning => (IconName::Warning, cx.theme().text_warning),
|
||||
Self::Error => (IconName::CloseCircle, cx.theme().danger_foreground),
|
||||
Self::Info => (IconName::Info, cx.theme().text_muted),
|
||||
Self::Success => (IconName::CheckCircle, cx.theme().success),
|
||||
Self::Warning => (IconName::Warning, cx.theme().warning),
|
||||
Self::Error => (IconName::CloseCircle, cx.theme().on_accent),
|
||||
};
|
||||
Icon::new(name).with_size(Size::Medium).text_color(color)
|
||||
}
|
||||
@@ -279,12 +279,12 @@ impl Render for Notification {
|
||||
};
|
||||
|
||||
let background = match self.kind {
|
||||
Some(NotificationKind::Error) => cx.theme().danger_background,
|
||||
_ => cx.theme().surface_background,
|
||||
Some(NotificationKind::Error) => cx.theme().danger_strong,
|
||||
_ => cx.theme().surface_overlay,
|
||||
};
|
||||
|
||||
let text_color = match self.kind {
|
||||
Some(NotificationKind::Error) => cx.theme().danger_foreground,
|
||||
Some(NotificationKind::Error) => cx.theme().on_accent,
|
||||
_ => cx.theme().text,
|
||||
};
|
||||
|
||||
@@ -305,8 +305,10 @@ impl Render for Notification {
|
||||
.border_color(cx.theme().border)
|
||||
.bg(background)
|
||||
.text_color(text_color)
|
||||
.rounded(cx.theme().radius_lg)
|
||||
.when(cx.theme().shadow, |this| this.shadow_md())
|
||||
.rounded(px(theme::surface_radius()))
|
||||
.when(cx.theme().shadow, |this| {
|
||||
this.shadow(theme::surface_shadows())
|
||||
})
|
||||
.p_2()
|
||||
.gap_2()
|
||||
.justify_start()
|
||||
|
||||
Reference in New Issue
Block a user