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,8 +302,7 @@ impl Render for Notification {
on_click(event, window, cx); on_click(event, window, cx);
})) }))
}) })
.when(!self.autohide, |this| { .child(
this.child(
h_flex() h_flex()
.absolute() .absolute()
.top_1() .top_1()
@ -315,12 +314,9 @@ impl Render for Notification {
.icon(IconName::Close) .icon(IconName::Close)
.ghost() .ghost()
.xsmall() .xsmall()
.on_click( .on_click(cx.listener(|this, _, window, cx| this.dismiss(window, cx))),
cx.listener(|this, _, window, cx| this.dismiss(window, cx)),
),
), ),
) )
})
.with_animation( .with_animation(
ElementId::NamedInteger("slide-down".into(), closing as u64), ElementId::NamedInteger("slide-down".into(), closing as u64),
Animation::new(Duration::from_secs_f64(0.15)) Animation::new(Duration::from_secs_f64(0.15))