diff --git a/assets/icons/file_icons/chevron_down.svg b/assets/icons/file_icons/chevron_down.svg new file mode 100644 index 0000000000000000000000000000000000000000..b971555cfa0b8c15daf35522a3f3ef449ffac087 --- /dev/null +++ b/assets/icons/file_icons/chevron_down.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/icons/file_icons/chevron_left.svg b/assets/icons/file_icons/chevron_left.svg new file mode 100644 index 0000000000000000000000000000000000000000..8e61beed5df055132edde2510908324cc8a47fb1 --- /dev/null +++ b/assets/icons/file_icons/chevron_left.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/icons/file_icons/chevron_right.svg b/assets/icons/file_icons/chevron_right.svg new file mode 100644 index 0000000000000000000000000000000000000000..fcd9d83fc203578f5135a5d040999bea6765769e --- /dev/null +++ b/assets/icons/file_icons/chevron_right.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/icons/file_icons/chevron_up.svg b/assets/icons/file_icons/chevron_up.svg new file mode 100644 index 0000000000000000000000000000000000000000..171cdd61c0511aabe2f25463089d3cfd9cbf5039 --- /dev/null +++ b/assets/icons/file_icons/chevron_up.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/icons/file_icons/file_types.json b/assets/icons/file_icons/file_types.json index edc398a295ac1efe77faf3101823d736f08add4a..b53d263063a1fa75a93ed7a317145af38ed86d07 100644 --- a/assets/icons/file_icons/file_types.json +++ b/assets/icons/file_icons/file_types.json @@ -94,20 +94,26 @@ "code": { "icon": "icons/file_icons/code.svg" }, - "default": { - "icon": "icons/file_icons/file.svg" + "collapsed_chevron": { + "icon": "icons/file_icons/chevron_right.svg" }, - "directory": { + "collapsed_folder": { "icon": "icons/file_icons/folder.svg" }, + "default": { + "icon": "icons/file_icons/file.svg" + }, "document": { "icon": "icons/file_icons/book.svg" }, "eslint": { "icon": "icons/file_icons/eslint.svg" }, - "expanded_directory": { - "icon": "icons/file_icons/folder-open.svg" + "expanded_chevron": { + "icon": "icons/file_icons/chevron_down.svg" + }, + "expanded_folder": { + "icon": "icons/file_icons/folder_open.svg" }, "image": { "icon": "icons/file_icons/image.svg" diff --git a/assets/icons/file_icons/folder.svg b/assets/icons/file_icons/folder.svg index 4ef944a69cab181eeb323be22acf881fcdbebd3f..d890160100e01d002287005574321b19180891e2 100644 --- a/assets/icons/file_icons/folder.svg +++ b/assets/icons/file_icons/folder.svg @@ -1,5 +1,5 @@ - + diff --git a/assets/icons/file_icons/folder-open.svg b/assets/icons/file_icons/folder_open.svg similarity index 89% rename from assets/icons/file_icons/folder-open.svg rename to assets/icons/file_icons/folder_open.svg index 405d0b83080b4995a56d19dc1e9538e80fc103af..bf64f6ee396a266bafcd542883ee9728fabb6376 100644 --- a/assets/icons/file_icons/folder-open.svg +++ b/assets/icons/file_icons/folder_open.svg @@ -1,5 +1,5 @@ - + diff --git a/crates/project_panel/src/file_associations.rs b/crates/project_panel/src/file_associations.rs index 6e2e373d766b02c04fb4ecd9cf4a4ba2cc0d3a0c..2694fa1697f31d76fb4f37e1632c184ac2e9ce8f 100644 --- a/crates/project_panel/src/file_associations.rs +++ b/crates/project_panel/src/file_associations.rs @@ -17,8 +17,10 @@ pub struct FileAssociations { types: HashMap, } -const DIRECTORY_TYPE: &'static str = "directory"; -const EXPANDED_DIRECTORY_TYPE: &'static str = "expanded_directory"; +const COLLAPSED_DIRECTORY_TYPE: &'static str = "collapsed_folder"; +const EXPANDED_DIRECTORY_TYPE: &'static str = "expanded_folder"; +const COLLAPSED_CHEVRON_TYPE: &'static str = "collapsed_chevron"; +const EXPANDED_CHEVRON_TYPE: &'static str = "expanded_chevron"; pub const FILE_TYPES_ASSET: &'static str = "icons/file_icons/file_types.json"; pub fn init(assets: impl AssetSource, cx: &mut AppContext) { @@ -72,7 +74,24 @@ impl FileAssociations { let key = if expanded { EXPANDED_DIRECTORY_TYPE } else { - DIRECTORY_TYPE + COLLAPSED_DIRECTORY_TYPE + }; + + this.types + .get(key) + .map(|type_config| type_config.icon.clone()) + }) + .unwrap_or_else(|| Arc::from("".to_string())) + } + + pub fn get_chevron_icon(expanded: bool, cx: &AppContext) -> Arc { + iife!({ + let this = cx.has_global::().then(|| cx.global::())?; + + let key = if expanded { + EXPANDED_CHEVRON_TYPE + } else { + COLLAPSED_CHEVRON_TYPE }; this.types