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:
@@ -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| {
|
||||
|
||||
Reference in New Issue
Block a user