Skip to content

Commit 3fe359a

Browse files
committed
add warning status to toast
1 parent 7a97773 commit 3fe359a

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

examples/toast/src/main.rs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,11 +189,17 @@ mod toast {
189189
Secondary,
190190
Success,
191191
Danger,
192+
Warning,
192193
}
193194

194195
impl Status {
195-
pub const ALL: &'static [Self] =
196-
&[Self::Primary, Self::Secondary, Self::Success, Self::Danger];
196+
pub const ALL: &'static [Self] = &[
197+
Self::Primary,
198+
Self::Secondary,
199+
Self::Success,
200+
Self::Danger,
201+
Self::Warning,
202+
];
197203
}
198204

199205
impl fmt::Display for Status {
@@ -203,6 +209,7 @@ mod toast {
203209
Status::Secondary => "Secondary",
204210
Status::Success => "Success",
205211
Status::Danger => "Danger",
212+
Status::Warning => "Warning",
206213
}
207214
.fmt(f)
208215
}
@@ -253,6 +260,7 @@ mod toast {
253260
Status::Secondary => secondary,
254261
Status::Success => success,
255262
Status::Danger => danger,
263+
Status::Warning => warning,
256264
}),
257265
horizontal_rule(1),
258266
container(text(toast.body.as_str()))
@@ -665,4 +673,10 @@ mod toast {
665673

666674
styled(palette.danger.weak)
667675
}
676+
677+
fn warning(theme: &Theme) -> container::Style {
678+
let palette = theme.extended_palette();
679+
680+
styled(palette.warning.weak)
681+
}
668682
}

0 commit comments

Comments
 (0)