add motion to toast
This commit is contained in:
@@ -3,9 +3,9 @@ use std::time::Duration;
|
||||
|
||||
use gpui::prelude::FluentBuilder as _;
|
||||
use gpui::{
|
||||
App, Context, ElementId, Entity, InteractiveElement as _, IntoElement, ParentElement as _,
|
||||
RenderOnce, SharedString, StatefulInteractiveElement as _, Styled as _, Window, deferred, div,
|
||||
px,
|
||||
Animation, AnimationExt as _, App, Context, ElementId, Entity, InteractiveElement as _,
|
||||
IntoElement, ParentElement as _, RenderOnce, SharedString, StatefulInteractiveElement as _,
|
||||
Styled as _, Window, deferred, div, ease_out_quint, px,
|
||||
};
|
||||
use gpui_native_icons::{IconRole, icon};
|
||||
use gpui_native_theme::ActiveTheme as _;
|
||||
@@ -201,6 +201,7 @@ impl RenderOnce for ToastsView {
|
||||
let radius = theme.radius.overlay;
|
||||
let shadows = theme.elevations.popover.shadows();
|
||||
let icon_size = theme.sizes.small.icon_size;
|
||||
let enter_duration = theme.motion.overlay;
|
||||
|
||||
let entries: Vec<ToastEntry> = self.toasts.read(cx).entries().to_vec();
|
||||
|
||||
@@ -296,6 +297,11 @@ impl RenderOnce for ToastsView {
|
||||
});
|
||||
}),
|
||||
)
|
||||
.with_animation(
|
||||
("toast-enter", entry.id),
|
||||
Animation::new(enter_duration).with_easing(ease_out_quint()),
|
||||
|toast, delta| toast.mt(px(8. * (1. - delta))),
|
||||
)
|
||||
})),
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user