Wire project panel themes into rust
This commit is contained in:
parent
b80cb73745
commit
2200a22c07
4 changed files with 47 additions and 76 deletions
|
@ -6,8 +6,8 @@ use gpui::{
|
|||
actions,
|
||||
anyhow::{anyhow, Result},
|
||||
elements::{
|
||||
AnchorCorner, ChildView, ComponentHost, ContainerStyle, Empty, Flex, MouseEventHandler,
|
||||
ParentElement, ScrollTarget, Stack, Svg, UniformList, UniformListState,
|
||||
AnchorCorner, ChildView, ContainerStyle, Empty, Flex, Label,
|
||||
MouseEventHandler, ParentElement, ScrollTarget, Stack, Svg, UniformList, UniformListState,
|
||||
},
|
||||
geometry::vector::Vector2F,
|
||||
keymap_matcher::KeymapContext,
|
||||
|
@ -28,7 +28,7 @@ use std::{
|
|||
path::Path,
|
||||
sync::Arc,
|
||||
};
|
||||
use theme::{ui::FileName, ProjectPanelEntry};
|
||||
use theme::ProjectPanelEntry;
|
||||
use unicase::UniCase;
|
||||
use workspace::Workspace;
|
||||
|
||||
|
@ -1079,6 +1079,17 @@ impl ProjectPanel {
|
|||
let kind = details.kind;
|
||||
let show_editor = details.is_editing && !details.is_processing;
|
||||
|
||||
let mut filename_text_style = style.text.clone();
|
||||
filename_text_style.color = details
|
||||
.git_status
|
||||
.as_ref()
|
||||
.map(|status| match status {
|
||||
GitFileStatus::Added => style.status.git.inserted,
|
||||
GitFileStatus::Modified => style.status.git.modified,
|
||||
GitFileStatus::Conflict => style.text.color,
|
||||
})
|
||||
.unwrap_or(style.text.color);
|
||||
|
||||
Flex::row()
|
||||
.with_child(
|
||||
if kind == EntryKind::Dir {
|
||||
|
@ -1106,16 +1117,12 @@ impl ProjectPanel {
|
|||
.flex(1.0, true)
|
||||
.into_any()
|
||||
} else {
|
||||
ComponentHost::new(FileName::new(
|
||||
details.filename.clone(),
|
||||
details.git_status,
|
||||
FileName::style(style.text.clone(), &theme::current(cx)),
|
||||
))
|
||||
.contained()
|
||||
.with_margin_left(style.icon_spacing)
|
||||
.aligned()
|
||||
.left()
|
||||
.into_any()
|
||||
Label::new(details.filename.clone(), filename_text_style)
|
||||
.contained()
|
||||
.with_margin_left(style.icon_spacing)
|
||||
.aligned()
|
||||
.left()
|
||||
.into_any()
|
||||
})
|
||||
.constrained()
|
||||
.with_height(style.height)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue