Improve styling of git menu

This commit is contained in:
Piotr Osiewicz 2023-06-30 16:38:38 +02:00
parent b699e5c142
commit ed75c31640
3 changed files with 26 additions and 22 deletions

View file

@ -215,8 +215,16 @@ impl PickerDelegate for BranchListDelegate {
let style = theme.picker.header.clone(); let style = theme.picker.header.clone();
if self.last_query.is_empty() { if self.last_query.is_empty() {
Some( Some(
Flex::row() Stack::new()
.with_child(Label::new("Recent branches", style)) .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(), .into_any(),
) )
} else { } else {
@ -224,7 +232,11 @@ impl PickerDelegate for BranchListDelegate {
Stack::new() Stack::new()
.with_child( .with_child(
Flex::row() 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(|| { .with_children(self.matches.is_empty().not().then(|| {
let suffix = if self.matches.len() == 1 { "" } else { "es" }; let suffix = if self.matches.len() == 1 { "" } else { "es" };
@ -232,11 +244,14 @@ impl PickerDelegate for BranchListDelegate {
.align_children_center() .align_children_center()
.with_child(Label::new( .with_child(Label::new(
format!("{} match{}", self.matches.len(), suffix), format!("{} match{}", self.matches.len(), suffix),
style, style.label,
)) ))
.aligned() .aligned()
.right() .right()
})) }))
.contained()
.with_style(style.container)
.constrained()
.into_any(), .into_any(),
) )
} }

View file

@ -585,8 +585,8 @@ pub struct Picker {
pub empty_input_editor: FieldEditor, pub empty_input_editor: FieldEditor,
pub no_matches: ContainedLabel, pub no_matches: ContainedLabel,
pub item: Toggleable<Interactive<ContainedLabel>>, pub item: Toggleable<Interactive<ContainedLabel>>,
pub header: LabelStyle, pub header: ContainedLabel,
pub footer: LabelStyle, pub footer: ContainedLabel,
} }
#[derive(Clone, Debug, Deserialize, Default, JsonSchema)] #[derive(Clone, Debug, Deserialize, Default, JsonSchema)]

View file

@ -110,30 +110,19 @@ export default function picker(theme: ColorScheme): any {
}, },
header: { header: {
text: text(theme.lowest, "sans", "variant", { size: "xs" }), text: text(theme.lowest, "sans", "variant", { size: "xs" }),
padding: {
bottom: 4,
left: 12,
right: 12,
top: 4,
},
margin: { margin: {
top: 1, top: 1,
left: 4, left: 8,
right: 4, right: 8,
}, },
}, },
footer: { footer: {
text: text(theme.lowest, "sans", "variant", { size: "xs" }), text: text(theme.lowest, "sans", "variant", { size: "xs" }),
padding: {
bottom: 4,
left: 12,
right: 12,
top: 4,
},
margin: { margin: {
top: 1, top: 1,
left: 4, left: 8,
right: 4, right: 8,
}, },
} }