From 7a0aa1e5df32396f71ab84fbaaf4b31d8df93eaf Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Mon, 4 Dec 2023 11:32:25 -0500 Subject: [PATCH] Clean up ButtonLike Co-Authored-By: Marshall Bowers <1486634+maxdeviant@users.noreply.github.com> --- .../ui2/src/components/button/button_like.rs | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/crates/ui2/src/components/button/button_like.rs b/crates/ui2/src/components/button/button_like.rs index 020de0cc8a75184d9e03c5761e40b873ba928e81..71aa31ced21e09fb69c1cda03a112bb9a2857c87 100644 --- a/crates/ui2/src/components/button/button_like.rs +++ b/crates/ui2/src/components/button/button_like.rs @@ -323,23 +323,13 @@ impl RenderOnce for ButtonLike { .id(self.id.clone()) .h(self.size.height()) .rounded_md() - .when(!self.disabled, |el| el.cursor_pointer()) .gap_1() .px_1() .bg(self.style.enabled(cx).background) - .hover(|hover| { - hover.bg(if self.disabled { - self.style.disabled(cx).background - } else { - self.style.hovered(cx).background - }) - }) - .active(|active| { - active.bg(if self.disabled { - self.style.disabled(cx).background - } else { - self.style.active(cx).background - }) + .when(!self.disabled, |this| { + this.cursor_pointer() + .hover(|hover| hover.bg(self.style.hovered(cx).background)) + .active(|active| active.bg(self.style.active(cx).background)) }) .when_some( self.on_click.filter(|_| !self.disabled),