From 2ec5c88f983664b4df9a283c22d594128b93b7c5 Mon Sep 17 00:00:00 2001 From: Petros Amoiridis Date: Wed, 22 Feb 2023 20:25:39 +0200 Subject: [PATCH 1/3] Make icon width match other areas This was 8 but we've seen areas where this was 14, like the project search tab icon. We want to match this. Co-Authored-By: Julia <30666851+ForLoveOfCats@users.noreply.github.com> --- styles/src/styleTree/tabBar.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/styles/src/styleTree/tabBar.ts b/styles/src/styleTree/tabBar.ts index a4875cec06..d874b86b1d 100644 --- a/styles/src/styleTree/tabBar.ts +++ b/styles/src/styleTree/tabBar.ts @@ -24,7 +24,7 @@ export default function tabBar(colorScheme: ColorScheme) { spacing: 8, // Close icons - iconWidth: 8, + iconWidth: 14, iconClose: foreground(layer, "variant"), iconCloseActive: foreground(layer, "hovered"), From 81ece4fd44cc4153e1e3514e352382ef83cba284 Mon Sep 17 00:00:00 2001 From: Petros Amoiridis Date: Wed, 22 Feb 2023 20:28:57 +0200 Subject: [PATCH 2/3] Deduplicate tab theme related code We've noticed that the search theme struct had two fields for a tab icon width and spacing. But we already have those in the tab theme struct. We decided to remove the duplicate and reuse the tab fields. We also wanted to move where the spacing is being used. Instead of doing it at the left of the label, we do it at the right of the icon to match how it is done in other areas of the UI. Co-Authored-By: Julia <30666851+ForLoveOfCats@users.noreply.github.com> --- crates/search/src/project_search.rs | 8 +++----- crates/theme/src/theme.rs | 2 -- styles/src/styleTree/search.ts | 2 -- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/crates/search/src/project_search.rs b/crates/search/src/project_search.rs index b2e3c81bc9..04f4b1470a 100644 --- a/crates/search/src/project_search.rs +++ b/crates/search/src/project_search.rs @@ -248,15 +248,15 @@ impl Item for ProjectSearchView { tab_theme: &theme::Tab, cx: &gpui::AppContext, ) -> ElementBox { - let settings = cx.global::(); - let search_theme = &settings.theme.search; Flex::row() .with_child( Svg::new("icons/magnifying_glass_12.svg") .with_color(tab_theme.label.text.color) .constrained() - .with_width(search_theme.tab_icon_width) + .with_width(tab_theme.icon_width) .aligned() + .contained() + .with_margin_right(tab_theme.spacing) .boxed(), ) .with_children(self.model.read(cx).active_query.as_ref().map(|query| { @@ -264,8 +264,6 @@ impl Item for ProjectSearchView { Label::new(query_text, tab_theme.label.clone()) .aligned() - .contained() - .with_margin_left(search_theme.tab_icon_spacing) .boxed() })) .boxed() diff --git a/crates/theme/src/theme.rs b/crates/theme/src/theme.rs index bc338bbe26..72ec15bb22 100644 --- a/crates/theme/src/theme.rs +++ b/crates/theme/src/theme.rs @@ -246,8 +246,6 @@ pub struct Search { pub match_background: Color, pub match_index: ContainedText, pub results_status: TextStyle, - pub tab_icon_width: f32, - pub tab_icon_spacing: f32, pub dismiss_button: Interactive, } diff --git a/styles/src/styleTree/search.ts b/styles/src/styleTree/search.ts index 2edd3807a5..5d5f2111dc 100644 --- a/styles/src/styleTree/search.ts +++ b/styles/src/styleTree/search.ts @@ -29,8 +29,6 @@ export default function search(colorScheme: ColorScheme) { return { // TODO: Add an activeMatchBackground on the rust side to differenciate between active and inactive matchBackground: withOpacity(foreground(layer, "accent"), 0.4), - tabIconSpacing: 8, - tabIconWidth: 14, optionButton: { ...text(layer, "mono", "on"), background: background(layer, "on"), From 3d6c81584f751ace64af15d8caa01b9a00434e27 Mon Sep 17 00:00:00 2001 From: Petros Amoiridis Date: Wed, 22 Feb 2023 20:30:44 +0200 Subject: [PATCH 3/3] Add an icon to the terminal view tab The terminal icon already existed in `assets/icons` Co-Authored-By: Julia <30666851+ForLoveOfCats@users.noreply.github.com> --- crates/terminal_view/src/terminal_view.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/crates/terminal_view/src/terminal_view.rs b/crates/terminal_view/src/terminal_view.rs index 58caf7d45d..69535bbd2b 100644 --- a/crates/terminal_view/src/terminal_view.rs +++ b/crates/terminal_view/src/terminal_view.rs @@ -589,11 +589,16 @@ impl Item for TerminalView { Flex::row() .with_child( - Label::new(title, tab_theme.label.clone()) + gpui::elements::Svg::new("icons/terminal_12.svg") + .with_color(tab_theme.label.text.color) + .constrained() + .with_width(tab_theme.icon_width) .aligned() .contained() + .with_margin_right(tab_theme.spacing) .boxed(), ) + .with_child(Label::new(title, tab_theme.label.clone()).aligned().boxed()) .boxed() }