Add StatusToast & the ToastLayer (#26232)
https://github.com/user-attachments/assets/b16e32e6-46c6-41dc-ab68-1824d288c8c2 This PR adds the first part of our planned extended notification system: StatusToasts. It also makes various updates to ComponentPreview and adds a `Styled` extension in `ui::style::animation` to make it easier to animate styled elements. _**Note**: We will be very, very selective with what elements are allowed to be animated in Zed. Assume PRs adding animation to elements will all need to be manually signed off on by a designer._ ## Status Toast  These are designed to be used for notifying about things that don't require an action to be taken or don't need to be triaged. They are designed to be ignorable, and dismiss themselves automatically after a set time. They can optionally include a single action. Example: When the user enables Vim Mode, that action might let them undo enabling it.  Status Toasts should _not_ be used when an action is required, or for any binary choice. If the user must provide some input, this isn't the right component! ### Out of scope - Toasts should fade over a short time (like AnimationDuration::Fast or Instant) when dismissed - We should visually show when the toast will dismiss. We'll need to pipe the `duration_remaining` from the toast layer -> ActiveToast to do this. - Dismiss any active toast if another notification kind is created, like a Notification or Alert. Release Notes: - N/A --------- Co-authored-by: Cole Miller <m@cole-miller.net>
This commit is contained in:
parent
b8a8b9c699
commit
7e964290bf
24 changed files with 1308 additions and 75 deletions
|
@ -33,14 +33,15 @@ pub fn derive_into_component(input: TokenStream) -> TokenStream {
|
|||
let name = &input.ident;
|
||||
|
||||
let scope_impl = if let Some(s) = scope_val {
|
||||
let scope_str = s.clone();
|
||||
quote! {
|
||||
fn scope() -> Option<&'static str> {
|
||||
Some(#s)
|
||||
fn scope() -> Option<component::ComponentScope> {
|
||||
Some(component::ComponentScope::from(#scope_str))
|
||||
}
|
||||
}
|
||||
} else {
|
||||
quote! {
|
||||
fn scope() -> Option<&'static str> {
|
||||
fn scope() -> Option<component::ComponentScope> {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue