Give hover state to picker items, keystrokes in command palette

This commit is contained in:
Max Brunsfeld 2022-04-28 15:17:56 -07:00
parent a60c75e343
commit 8481834847
20 changed files with 269 additions and 288 deletions

View file

@ -193,13 +193,7 @@ impl View for SidebarButtons {
Flex::row()
.with_children(items.iter().enumerate().map(|(ix, item)| {
MouseEventHandler::new::<Self, _, _>(ix, cx, move |state, _| {
let style = if Some(ix) == active_ix {
item_style.active()
} else if state.hovered {
item_style.hover()
} else {
&item_style.default
};
let style = item_style.style_for(state, Some(ix) == active_ix);
Svg::new(item.icon_path)
.with_color(style.icon_color)
.constrained()

View file

@ -1574,11 +1574,11 @@ impl Workspace {
} else {
Some(
MouseEventHandler::new::<Authenticate, _, _>(0, cx, |state, _| {
let style = if state.hovered {
&theme.workspace.titlebar.sign_in_prompt.hover()
} else {
&theme.workspace.titlebar.sign_in_prompt.default
};
let style = theme
.workspace
.titlebar
.sign_in_prompt
.style_for(state, false);
Label::new("Sign in".to_string(), style.text.clone())
.contained()
.with_style(style.container)
@ -1649,18 +1649,11 @@ impl Workspace {
{
Some(
MouseEventHandler::new::<ToggleShare, _, _>(0, cx, |state, cx| {
let style = &theme.workspace.titlebar.share_icon;
let style = if self.project().read(cx).is_shared() {
if state.hovered {
style.active_hover()
} else {
&style.active()
}
} else if state.hovered {
&style.active()
} else {
&style.default
};
let style = &theme
.workspace
.titlebar
.share_icon
.style_for(state, self.project().read(cx).is_shared());
Svg::new("icons/share.svg")
.with_color(style.color)
.constrained()