🎨 Use Interactive wrapper for search option buttons
This commit is contained in:
parent
8481834847
commit
d9497d49de
12 changed files with 226 additions and 584 deletions
|
@ -281,13 +281,12 @@ impl BufferSearchBar {
|
|||
) -> ElementBox {
|
||||
let is_active = self.is_search_option_enabled(search_option);
|
||||
MouseEventHandler::new::<Self, _, _>(search_option as usize, cx, |state, cx| {
|
||||
let theme = &cx.global::<Settings>().theme.search;
|
||||
let style = match (is_active, state.hovered) {
|
||||
(false, false) => &theme.option_button,
|
||||
(false, true) => &theme.hovered_option_button,
|
||||
(true, false) => &theme.active_option_button,
|
||||
(true, true) => &theme.active_hovered_option_button,
|
||||
};
|
||||
let style = &cx
|
||||
.global::<Settings>()
|
||||
.theme
|
||||
.search
|
||||
.option_button
|
||||
.style_for(state, is_active);
|
||||
Label::new(icon.to_string(), style.text.clone())
|
||||
.contained()
|
||||
.with_style(style.container)
|
||||
|
@ -306,12 +305,12 @@ impl BufferSearchBar {
|
|||
) -> ElementBox {
|
||||
enum NavButton {}
|
||||
MouseEventHandler::new::<NavButton, _, _>(direction as usize, cx, |state, cx| {
|
||||
let theme = &cx.global::<Settings>().theme.search;
|
||||
let style = if state.hovered {
|
||||
&theme.hovered_option_button
|
||||
} else {
|
||||
&theme.option_button
|
||||
};
|
||||
let style = &cx
|
||||
.global::<Settings>()
|
||||
.theme
|
||||
.search
|
||||
.option_button
|
||||
.style_for(state, false);
|
||||
Label::new(icon.to_string(), style.text.clone())
|
||||
.contained()
|
||||
.with_style(style.container)
|
||||
|
|
|
@ -655,12 +655,12 @@ impl ProjectSearchBar {
|
|||
) -> ElementBox {
|
||||
enum NavButton {}
|
||||
MouseEventHandler::new::<NavButton, _, _>(direction as usize, cx, |state, cx| {
|
||||
let theme = &cx.global::<Settings>().theme.search;
|
||||
let style = if state.hovered {
|
||||
&theme.hovered_option_button
|
||||
} else {
|
||||
&theme.option_button
|
||||
};
|
||||
let style = &cx
|
||||
.global::<Settings>()
|
||||
.theme
|
||||
.search
|
||||
.option_button
|
||||
.style_for(state, false);
|
||||
Label::new(icon.to_string(), style.text.clone())
|
||||
.contained()
|
||||
.with_style(style.container)
|
||||
|
@ -682,13 +682,12 @@ impl ProjectSearchBar {
|
|||
) -> ElementBox {
|
||||
let is_active = self.is_option_enabled(option, cx);
|
||||
MouseEventHandler::new::<ProjectSearchBar, _, _>(option as usize, cx, |state, cx| {
|
||||
let theme = &cx.global::<Settings>().theme.search;
|
||||
let style = match (is_active, state.hovered) {
|
||||
(false, false) => &theme.option_button,
|
||||
(false, true) => &theme.hovered_option_button,
|
||||
(true, false) => &theme.active_option_button,
|
||||
(true, true) => &theme.active_hovered_option_button,
|
||||
};
|
||||
let style = &cx
|
||||
.global::<Settings>()
|
||||
.theme
|
||||
.search
|
||||
.option_button
|
||||
.style_for(state, is_active);
|
||||
Label::new(icon.to_string(), style.text.clone())
|
||||
.contained()
|
||||
.with_style(style.container)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue