add motion to toast

This commit is contained in:
2026-10-30 10:28:47 +07:00
parent cf400ee65c
commit c4955cca18
3 changed files with 11 additions and 7 deletions
-2
View File
@@ -194,8 +194,6 @@ impl RenderOnce for Button {
.hover(move |style| style.bg(hover))
.active(move |style| style.bg(pressed))
.focus_visible(|style| {
// Paint-only keyboard ring; the width joins the native
// metrics table when that lands.
style.shadow(vec![
BoxShadow::new(px(0.), px(0.), colors.ring).spread_radius(px(3.)),
])
+9 -3
View File
@@ -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))),
)
})),
)
}