Use small labels for title bar buttons (#3763)

Marshall Bowers created

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

Change summary

crates/collab_ui2/src/collab_titlebar_item.rs | 2 ++
crates/ui2/src/components/button/button.rs    | 8 ++++++++
2 files changed, 10 insertions(+)

Detailed changes

crates/collab_ui2/src/collab_titlebar_item.rs 🔗

@@ -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",

crates/ui2/src/components/button/button.rs 🔗

@@ -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| {