notification: Show the close button when auto-hide is enabled (#977)

This commit is contained in:
Floyd Wang 2025-06-18 11:34:11 +08:00 committed by GitHub
parent 934d08c332
commit fe342919e6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -302,25 +302,21 @@ impl Render for Notification {
on_click(event, window, cx);
}))
})
.when(!self.autohide, |this| {
this.child(
h_flex()
.absolute()
.top_1()
.right_1()
.invisible()
.group_hover("", |this| this.visible())
.child(
Button::new("close")
.icon(IconName::Close)
.ghost()
.xsmall()
.on_click(
cx.listener(|this, _, window, cx| this.dismiss(window, cx)),
),
),
)
})
.child(
h_flex()
.absolute()
.top_1()
.right_1()
.invisible()
.group_hover("", |this| this.visible())
.child(
Button::new("close")
.icon(IconName::Close)
.ghost()
.xsmall()
.on_click(cx.listener(|this, _, window, cx| this.dismiss(window, cx))),
),
)
.with_animation(
ElementId::NamedInteger("slide-down".into(), closing as u64),
Animation::new(Duration::from_secs_f64(0.15))