From ed75c316405814d2d06c96affb0d07de292ec3ad Mon Sep 17 00:00:00 2001 From: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com> Date: Fri, 30 Jun 2023 16:38:38 +0200 Subject: [PATCH] Improve styling of git menu --- crates/collab_ui/src/branch_list.rs | 23 +++++++++++++++++++---- crates/theme/src/theme.rs | 4 ++-- styles/src/style_tree/picker.ts | 21 +++++---------------- 3 files changed, 26 insertions(+), 22 deletions(-) diff --git a/crates/collab_ui/src/branch_list.rs b/crates/collab_ui/src/branch_list.rs index 95e418e67f..0abe83f766 100644 --- a/crates/collab_ui/src/branch_list.rs +++ b/crates/collab_ui/src/branch_list.rs @@ -215,8 +215,16 @@ impl PickerDelegate for BranchListDelegate { let style = theme.picker.header.clone(); if self.last_query.is_empty() { Some( - Flex::row() - .with_child(Label::new("Recent branches", style)) + Stack::new() + .with_child( + Flex::row() + .with_child(Label::new("Recent branches", style.label.clone())) + .contained() + .with_style(style.container) + .into_any(), + ) + .contained() + .with_style(style.container) .into_any(), ) } else { @@ -224,7 +232,11 @@ impl PickerDelegate for BranchListDelegate { Stack::new() .with_child( Flex::row() - .with_child(Label::new("Branches", style.clone()).aligned().left()), + .with_child( + Label::new("Branches", style.label.clone()).aligned().left(), + ) + .contained() + .with_style(style.container), ) .with_children(self.matches.is_empty().not().then(|| { let suffix = if self.matches.len() == 1 { "" } else { "es" }; @@ -232,11 +244,14 @@ impl PickerDelegate for BranchListDelegate { .align_children_center() .with_child(Label::new( format!("{} match{}", self.matches.len(), suffix), - style, + style.label, )) .aligned() .right() })) + .contained() + .with_style(style.container) + .constrained() .into_any(), ) } diff --git a/crates/theme/src/theme.rs b/crates/theme/src/theme.rs index 687547a306..c224131d1e 100644 --- a/crates/theme/src/theme.rs +++ b/crates/theme/src/theme.rs @@ -585,8 +585,8 @@ pub struct Picker { pub empty_input_editor: FieldEditor, pub no_matches: ContainedLabel, pub item: Toggleable>, - pub header: LabelStyle, - pub footer: LabelStyle, + pub header: ContainedLabel, + pub footer: ContainedLabel, } #[derive(Clone, Debug, Deserialize, Default, JsonSchema)] diff --git a/styles/src/style_tree/picker.ts b/styles/src/style_tree/picker.ts index 9918d1a2d6..6a7221efb0 100644 --- a/styles/src/style_tree/picker.ts +++ b/styles/src/style_tree/picker.ts @@ -110,30 +110,19 @@ export default function picker(theme: ColorScheme): any { }, header: { text: text(theme.lowest, "sans", "variant", { size: "xs" }), - padding: { - bottom: 4, - left: 12, - right: 12, - top: 4, - }, + margin: { top: 1, - left: 4, - right: 4, + left: 8, + right: 8, }, }, footer: { text: text(theme.lowest, "sans", "variant", { size: "xs" }), - padding: { - bottom: 4, - left: 12, - right: 12, - top: 4, - }, margin: { top: 1, - left: 4, - right: 4, + left: 8, + right: 8, }, }