Skip to content

Commit

Permalink
theme: Rename destructive to danger
Browse files Browse the repository at this point in the history
  • Loading branch information
madcodelife committed Jan 10, 2025
1 parent 31736b0 commit f98602d
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 31 deletions.
4 changes: 2 additions & 2 deletions crates/story/src/text_story.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,15 +253,15 @@ impl Render for TextStory {
.child(Tag::primary().small().child("Tag"))
.child(Tag::secondary().small().child("Secondary"))
.child(Tag::outline().small().child("Outline"))
.child(Tag::destructive().small().child("Destructive"))
.child(Tag::danger().small().child("danger"))
.child(Tag::custom(ui::yellow_500(), ui::yellow_800(), ui::yellow_500()).small().child("Custom"))
)
.child(
h_flex().gap_2()
.child(Tag::primary().child("Tag"))
.child(Tag::secondary().child("Secondary"))
.child(Tag::outline().child("Outline"))
.child(Tag::destructive().child("Destructive"))
.child(Tag::danger().child("danger"))
.child(Tag::custom(ui::yellow_500(), ui::yellow_800(), ui::yellow_500()).child("Custom"))
)
)
Expand Down
14 changes: 7 additions & 7 deletions crates/ui/src/button.rs
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ impl ButtonVariant {
match self {
ButtonVariant::Primary => cx.theme().primary,
ButtonVariant::Secondary => cx.theme().secondary,
ButtonVariant::Danger => cx.theme().destructive,
ButtonVariant::Danger => cx.theme().danger,
ButtonVariant::Outline
| ButtonVariant::Ghost
| ButtonVariant::Link
Expand All @@ -488,7 +488,7 @@ impl ButtonVariant {
ButtonVariant::Secondary | ButtonVariant::Outline | ButtonVariant::Ghost => {
cx.theme().secondary_foreground
}
ButtonVariant::Danger => cx.theme().destructive_foreground,
ButtonVariant::Danger => cx.theme().danger_foreground,
ButtonVariant::Link => cx.theme().link,
ButtonVariant::Text => cx.theme().foreground,
ButtonVariant::Custom(colors) => colors.foreground,
Expand All @@ -499,7 +499,7 @@ impl ButtonVariant {
match self {
ButtonVariant::Primary => cx.theme().primary,
ButtonVariant::Secondary => cx.theme().border,
ButtonVariant::Danger => cx.theme().destructive,
ButtonVariant::Danger => cx.theme().danger,
ButtonVariant::Outline => cx.theme().border,
ButtonVariant::Ghost | ButtonVariant::Link | ButtonVariant::Text => {
cx.theme().transparent
Expand Down Expand Up @@ -543,7 +543,7 @@ impl ButtonVariant {
let bg = match self {
ButtonVariant::Primary => cx.theme().primary_hover,
ButtonVariant::Secondary | ButtonVariant::Outline => cx.theme().secondary_hover,
ButtonVariant::Danger => cx.theme().destructive_hover,
ButtonVariant::Danger => cx.theme().danger_hover,
ButtonVariant::Ghost => {
if cx.theme().mode.is_dark() {
cx.theme().secondary.lighten(0.1).opacity(0.8)
Expand Down Expand Up @@ -583,7 +583,7 @@ impl ButtonVariant {
cx.theme().secondary.darken(0.2).opacity(0.8)
}
}
ButtonVariant::Danger => cx.theme().destructive_active,
ButtonVariant::Danger => cx.theme().danger_active,
ButtonVariant::Link => cx.theme().transparent,
ButtonVariant::Text => cx.theme().transparent,
ButtonVariant::Custom(colors) => colors.active,
Expand Down Expand Up @@ -617,7 +617,7 @@ impl ButtonVariant {
cx.theme().secondary.darken(0.2).opacity(0.8)
}
}
ButtonVariant::Danger => cx.theme().destructive_active,
ButtonVariant::Danger => cx.theme().danger_active,
ButtonVariant::Link => cx.theme().transparent,
ButtonVariant::Text => cx.theme().transparent,
ButtonVariant::Custom(colors) => colors.active,
Expand Down Expand Up @@ -647,7 +647,7 @@ impl ButtonVariant {
| ButtonVariant::Outline
| ButtonVariant::Text => cx.theme().transparent,
ButtonVariant::Primary => cx.theme().primary.opacity(0.15),
ButtonVariant::Danger => cx.theme().destructive.opacity(0.15),
ButtonVariant::Danger => cx.theme().danger.opacity(0.15),
ButtonVariant::Secondary => cx.theme().secondary.opacity(1.5),
ButtonVariant::Custom(style) => style.color.opacity(0.15),
};
Expand Down
12 changes: 6 additions & 6 deletions crates/ui/src/tag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub enum TagVariant {
Primary,
Secondary,
Outline,
Destructive,
Danger,
Custom {
color: Hsla,
foreground: Hsla,
Expand All @@ -23,7 +23,7 @@ impl TagVariant {
Self::Primary => cx.theme().primary,
Self::Secondary => cx.theme().secondary,
Self::Outline => transparent_black(),
Self::Destructive => cx.theme().destructive,
Self::Danger => cx.theme().danger,
Self::Custom { color, .. } => *color,
}
}
Expand All @@ -33,7 +33,7 @@ impl TagVariant {
Self::Primary => cx.theme().primary,
Self::Secondary => cx.theme().secondary,
Self::Outline => cx.theme().border,
Self::Destructive => cx.theme().destructive,
Self::Danger => cx.theme().danger,
Self::Custom { border, .. } => *border,
}
}
Expand All @@ -43,7 +43,7 @@ impl TagVariant {
Self::Primary => cx.theme().primary_foreground,
Self::Secondary => cx.theme().secondary_foreground,
Self::Outline => cx.theme().foreground,
Self::Destructive => cx.theme().destructive_foreground,
Self::Danger => cx.theme().danger_foreground,
Self::Custom { foreground, .. } => *foreground,
}
}
Expand Down Expand Up @@ -84,8 +84,8 @@ impl Tag {
Self::new().with_variant(TagVariant::Outline)
}

pub fn destructive() -> Self {
Self::new().with_variant(TagVariant::Destructive)
pub fn danger() -> Self {
Self::new().with_variant(TagVariant::Danger)
}

pub fn custom(color: Hsla, foreground: Hsla, border: Hsla) -> Self {
Expand Down
32 changes: 16 additions & 16 deletions crates/ui/src/theme.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,10 @@ pub struct ThemeColor {
pub window_border: Hsla,
pub card: Hsla,
pub card_foreground: Hsla,
pub destructive: Hsla,
pub destructive_active: Hsla,
pub destructive_foreground: Hsla,
pub destructive_hover: Hsla,
pub danger: Hsla,
pub danger_active: Hsla,
pub danger_foreground: Hsla,
pub danger_hover: Hsla,
pub drag_border: Hsla,
pub drop_target: Hsla,
pub foreground: Hsla,
Expand Down Expand Up @@ -234,10 +234,10 @@ impl ThemeColor {
window_border: hsl(240.0, 5.9, 78.0),
card: hsl(0.0, 0.0, 100.0),
card_foreground: hsl(240.0, 10.0, 3.9),
destructive: hsl(0.0, 84.2, 60.2),
destructive_active: hsl(0.0, 84.2, 47.0),
destructive_foreground: hsl(0.0, 0.0, 98.0),
destructive_hover: hsl(0.0, 84.2, 65.0),
danger: hsl(0.0, 84.2, 60.2),
danger_active: hsl(0.0, 84.2, 47.0),
danger_foreground: hsl(0.0, 0.0, 98.0),
danger_hover: hsl(0.0, 84.2, 65.0),
drag_border: crate::blue_500(),
drop_target: hsl(235.0, 30., 44.0).opacity(0.25),
foreground: hsl(240.0, 10., 3.9),
Expand Down Expand Up @@ -310,10 +310,10 @@ impl ThemeColor {
window_border: hsl(240.0, 3.7, 28.0),
card: hsl(0.0, 0.0, 8.0),
card_foreground: hsl(0.0, 0.0, 78.0),
destructive: hsl(0.0, 62.8, 30.6),
destructive_active: hsl(0.0, 62.8, 20.6),
destructive_foreground: hsl(0.0, 0.0, 78.0),
destructive_hover: hsl(0.0, 62.8, 35.6),
danger: hsl(0.0, 62.8, 30.6),
danger_active: hsl(0.0, 62.8, 20.6),
danger_foreground: hsl(0.0, 0.0, 78.0),
danger_hover: hsl(0.0, 62.8, 35.6),
drag_border: crate::blue_500(),
drop_target: hsl(235.0, 30., 44.0).opacity(0.1),
foreground: hsl(0., 0., 78.),
Expand Down Expand Up @@ -434,10 +434,10 @@ impl Theme {
self.secondary_hover = self.secondary_hover.apply(mask_color);
self.secondary_active = self.secondary_active.apply(mask_color);
self.secondary_foreground = self.secondary_foreground.apply(mask_color);
// self.destructive = self.destructive.apply(mask_color);
// self.destructive_hover = self.destructive_hover.apply(mask_color);
// self.destructive_active = self.destructive_active.apply(mask_color);
// self.destructive_foreground = self.destructive_foreground.apply(mask_color);
// self.danger = self.danger.apply(mask_color);
// self.danger_hover = self.danger_hover.apply(mask_color);
// self.danger_active = self.danger_active.apply(mask_color);
// self.danger_foreground = self.danger_foreground.apply(mask_color);
self.muted = self.muted.apply(mask_color);
self.muted_foreground = self.muted_foreground.apply(mask_color);
self.accent = self.accent.apply(mask_color);
Expand Down

0 comments on commit f98602d

Please sign in to comment.