diff --git a/crates/story/src/notification_story.rs b/crates/story/src/notification_story.rs index cac6e5ee..2a1aacd8 100644 --- a/crates/story/src/notification_story.rs +++ b/crates/story/src/notification_story.rs @@ -6,6 +6,7 @@ use gpui::{ use gpui_component::{ WindowExt as _, button::{Button, ButtonVariants}, + h_flex, notification::{Notification, NotificationType}, text::TextView, v_flex, @@ -91,7 +92,7 @@ impl Render for NotificationStory { ) .child( Button::new("show-notify-error") - .outline() + .danger() .label("Error") .on_click(cx.listener(|_, _, window, cx| { window.push_notification( @@ -122,17 +123,61 @@ impl Render for NotificationStory { .warning() .label("Warning") .on_click(cx.listener(|_, _, window, cx| { - struct WarningNotification; window.push_notification( - Notification::warning( + ( + NotificationType::Warning, "The network is not stable, please check your connection.", - ) - .id1::("test"), + ), cx, ) })), ), ) + .child( + section("Unique Notification").child( + Button::new("show-notify-unique") + .outline() + .label("Unique Notification") + .on_click(cx.listener(|_, _, window, cx| { + window.push_notification( + Notification::info("This is a unique notification.") + .id::() + .message("This is a unique notification."), + cx, + ) + })), + ), + ) + .child( + section("Unique with Key").child( + h_flex() + .gap_3() + .child( + Button::new("show-notify-unique-key0") + .outline() + .label("A Notification") + .on_click(cx.listener(|_, _, window, cx| { + window.push_notification( + Notification::info("This is A unique notification.") + .id1::(1), + cx, + ) + })), + ) + .child( + Button::new("show-notify-unique-key1") + .outline() + .label("B Notification") + .on_click(cx.listener(|_, _, window, cx| { + window.push_notification( + Notification::info("This is B unique notification.") + .id1::(2), + cx, + ) + })), + ), + ), + ) .child( section("With title and action").child( Button::new("show-notify-with-title")