alert: add inline style with severity accent bar

This commit is contained in:
2026-11-16 10:18:47 +07:00
parent 1df87c65a1
commit 573d8a8303
2 changed files with 139 additions and 85 deletions
+21 -7
View File
@@ -9,7 +9,7 @@ use gpui::{
SharedString, Styled as _, UniformListScrollHandle, WeakEntity, Window, WindowBounds,
WindowOptions, actions, div, list, px, rems, size, uniform_list,
};
use gpui_native_core::alert::{Alert, AlertSeverity, Alerts};
use gpui_native_core::alert::{Alert, AlertSeverity, AlertStyle, Alerts};
use gpui_native_core::avatar::Avatar;
use gpui_native_core::badge::{Badge, BadgeVariant};
use gpui_native_core::button::{Button, ButtonVariant};
@@ -2609,17 +2609,31 @@ impl Render for AlertDemo {
v_flex()
.gap_2()
.child(
Alert::new("alert-demo-update")
.title("Update available")
.message("Version 2.4.0 is ready to install.")
.severity(AlertSeverity::Info),
Alert::new("alert-demo-sent")
.style(AlertStyle::Inline)
.severity(AlertSeverity::Success)
.icon(IconRole::Check)
.title("Message sent")
.message("Your message successfully sent to the recipient."),
)
.child(
Alert::new("alert-demo-hold")
.style(AlertStyle::Inline)
.severity(AlertSeverity::Info)
.icon(IconRole::Info)
.title("Keep in mind")
.message(
"Your message is temporarily on hold, please take action.",
),
)
.when(!self.dismissed, |section| {
section.child(
Alert::new("alert-demo-sync")
.title("Sync failed")
.message("Will retry when you're back online.")
.style(AlertStyle::Inline)
.severity(AlertSeverity::Danger)
.icon(IconRole::Warning)
.title("Something went wrong")
.message("Will retry when you're back online.")
.on_dismiss(move |cx| {
view.update(cx, |demo, cx| {
demo.dismissed = true;