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>
This commit is contained in:
Petros Amoiridis 2023-02-22 20:28:57 +02:00
parent 2ec5c88f98
commit 81ece4fd44
No known key found for this signature in database
3 changed files with 3 additions and 9 deletions

View file

@ -248,15 +248,15 @@ impl Item for ProjectSearchView {
tab_theme: &theme::Tab,
cx: &gpui::AppContext,
) -> ElementBox {
let settings = cx.global::<Settings>();
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()