Use small labels for title bar buttons (#3763)

This PR adjusts the sizing of the labels in the buttons in the title bar
to use the small label size.

This should bring them more in line with how things looked in Zed1.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2023-12-21 15:48:37 -05:00 committed by GitHub
parent a1fe514411
commit dabc98690c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View File

@ -334,6 +334,7 @@ impl CollabTitlebarItem {
.trigger(
Button::new("project_name_trigger", name)
.style(ButtonStyle::Subtle)
.label_size(LabelSize::Small)
.tooltip(move |cx| Tooltip::text("Recent Projects", cx))
.on_click(cx.listener(|this, _, cx| {
this.toggle_project_menu(&ToggleProjectMenu, cx);
@ -368,6 +369,7 @@ impl CollabTitlebarItem {
Button::new("project_branch_trigger", branch_name)
.color(Color::Muted)
.style(ButtonStyle::Subtle)
.label_size(LabelSize::Small)
.tooltip(move |cx| {
Tooltip::with_meta(
"Recent Branches",

View File

@ -12,6 +12,7 @@ pub struct Button {
base: ButtonLike,
label: SharedString,
label_color: Option<Color>,
label_size: Option<LabelSize>,
selected_label: Option<SharedString>,
icon: Option<Icon>,
icon_position: Option<IconPosition>,
@ -26,6 +27,7 @@ impl Button {
base: ButtonLike::new(id),
label: label.into(),
label_color: None,
label_size: None,
selected_label: None,
icon: None,
icon_position: None,
@ -40,6 +42,11 @@ impl Button {
self
}
pub fn label_size(mut self, label_size: impl Into<Option<LabelSize>>) -> Self {
self.label_size = label_size.into();
self
}
pub fn selected_label<L: Into<SharedString>>(mut self, label: impl Into<Option<L>>) -> Self {
self.selected_label = label.into().map(Into::into);
self
@ -164,6 +171,7 @@ impl RenderOnce for Button {
.child(
Label::new(label)
.color(label_color)
.size(self.label_size.unwrap_or_default())
.line_height_style(LineHeightStyle::UILabel),
)
.when(!self.icon_position.is_some(), |this| {