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); on_click(event, window, cx);
})) }))
}) })
.when(!self.autohide, |this| { .child(
this.child( h_flex()
h_flex() .absolute()
.absolute() .top_1()
.top_1() .right_1()
.right_1() .invisible()
.invisible() .group_hover("", |this| this.visible())
.group_hover("", |this| this.visible()) .child(
.child( Button::new("close")
Button::new("close") .icon(IconName::Close)
.icon(IconName::Close) .ghost()
.ghost() .xsmall()
.xsmall() .on_click(cx.listener(|this, _, window, cx| this.dismiss(window, cx))),
.on_click( ),
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))