Style the active entry in the project panel

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Max Brunsfeld 2021-09-30 14:16:28 -07:00
parent ad92bfe79f
commit 6007fa6ab3
3 changed files with 11 additions and 7 deletions

View file

@ -179,7 +179,11 @@ background = "$state.hover"
[project_panel.selected_entry]
extends = "$project_panel.entry"
background = "#ff0000"
text = { extends = "$text.0" }
[project_panel.hovered_selected_entry]
extends = "$project_panel.hovered_entry"
text = { extends = "$text.0" }
[selector]
background = "$surface.0"

View file

@ -469,12 +469,11 @@ impl ProjectPanel {
(entry.worktree_id, entry.entry_id),
cx,
|state, _| {
let style = if details.is_selected {
&theme.selected_entry
} else if state.hovered {
&theme.hovered_entry
} else {
&theme.entry
let style = match (details.is_selected, state.hovered) {
(false, false) => &theme.entry,
(false, true) => &theme.hovered_entry,
(true, false) => &theme.selected_entry,
(true, true) => &theme.hovered_selected_entry,
};
Flex::row()
.with_child(

View file

@ -116,6 +116,7 @@ pub struct ProjectPanel {
pub entry: ProjectPanelEntry,
pub hovered_entry: ProjectPanelEntry,
pub selected_entry: ProjectPanelEntry,
pub hovered_selected_entry: ProjectPanelEntry,
}
#[derive(Debug, Deserialize)]