From 8321b9430e640158c110e60cb069c94b8aac34cc Mon Sep 17 00:00:00 2001 From: Marshall Bowers Date: Wed, 18 Oct 2023 10:53:42 -0400 Subject: [PATCH] Wire up hover styles on `Button`s --- crates/ui2/src/elements/button.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/crates/ui2/src/elements/button.rs b/crates/ui2/src/elements/button.rs index e57057360c..65f0db175a 100644 --- a/crates/ui2/src/elements/button.rs +++ b/crates/ui2/src/elements/button.rs @@ -162,7 +162,15 @@ impl Button { .rounded_md() .border() .border_color(border_color) - .bg(self.background_color(cx)); + .bg(self.background_color(cx)) + .hover(|style| { + let color = ThemeColor::new(cx); + + style.bg(match self.variant { + ButtonVariant::Ghost => color.ghost_element_hover, + ButtonVariant::Filled => color.filled_element_hover, + }) + }); match (self.icon, self.icon_position) { (Some(_), Some(IconPosition::Left)) => {