From 3d1e52297eef39d164e4d838088095179070a8b4 Mon Sep 17 00:00:00 2001 From: Marshall Bowers Date: Thu, 21 Dec 2023 17:42:54 -0500 Subject: [PATCH] Scale down status bar items (#3766) This PR scales down the sizes of items in the status bar. This brings us more in line with Zed1. Release Notes: - N/A --- .../src/activity_indicator.rs | 4 +- crates/copilot_button2/src/copilot_button.rs | 4 +- crates/diagnostics2/src/items.rs | 45 ++++++++++++++----- crates/editor2/src/items.rs | 2 +- .../feedback2/src/deploy_feedback_button.rs | 1 + .../src/active_buffer_language.rs | 3 +- crates/vim2/src/mode_indicator.rs | 6 +-- crates/workspace2/src/dock.rs | 1 + 8 files changed, 48 insertions(+), 18 deletions(-) diff --git a/crates/activity_indicator2/src/activity_indicator.rs b/crates/activity_indicator2/src/activity_indicator.rs index f83517e0618316a5407f5ab6a9bc3cabc653033a..2b7846cd8d96a9c9014c0e4ab05595df4757509e 100644 --- a/crates/activity_indicator2/src/activity_indicator.rs +++ b/crates/activity_indicator2/src/activity_indicator.rs @@ -10,7 +10,7 @@ use language::{LanguageRegistry, LanguageServerBinaryStatus}; use project::{LanguageServerProgress, Project}; use smallvec::SmallVec; use std::{cmp::Reverse, fmt::Write, sync::Arc}; -use ui::{h_stack, Label}; +use ui::prelude::*; use util::ResultExt; use workspace::{item::ItemHandle, StatusItemView, Workspace}; @@ -324,7 +324,7 @@ impl Render for ActivityIndicator { result .children(content.icon.map(|icon| svg().path(icon))) - .child(Label::new(SharedString::from(content.message))) + .child(Label::new(SharedString::from(content.message)).size(LabelSize::Small)) } } diff --git a/crates/copilot_button2/src/copilot_button.rs b/crates/copilot_button2/src/copilot_button.rs index dc6f8085339de18f40bd1c4262bc3b9e0d8c9a67..705bdc1bec52f99690287efb8cc351337148a8db 100644 --- a/crates/copilot_button2/src/copilot_button.rs +++ b/crates/copilot_button2/src/copilot_button.rs @@ -18,7 +18,8 @@ use workspace::{ create_and_open_local_file, item::ItemHandle, ui::{ - popover_menu, ButtonCommon, Clickable, ContextMenu, Icon, IconButton, PopoverMenu, Tooltip, + popover_menu, ButtonCommon, Clickable, ContextMenu, Icon, IconButton, IconSize, + PopoverMenu, Tooltip, }, StatusItemView, Toast, Workspace, }; @@ -69,6 +70,7 @@ impl Render for CopilotButton { if let Status::Error(e) = status { return div().child( IconButton::new("copilot-error", icon) + .icon_size(IconSize::Small) .on_click(cx.listener(move |this, _, cx| { if let Some(workspace) = cx.window_handle().downcast::() { workspace.update(cx, |workspace, cx| { diff --git a/crates/diagnostics2/src/items.rs b/crates/diagnostics2/src/items.rs index 14ebe0c5166e07a641e6e94bec54025eaed6c0b7..cc598ba90ca741e3b4024512544a81d0655d281c 100644 --- a/crates/diagnostics2/src/items.rs +++ b/crates/diagnostics2/src/items.rs @@ -25,29 +25,54 @@ impl Render for DiagnosticIndicator { fn render(&mut self, cx: &mut ViewContext) -> Self::Element { let diagnostic_indicator = match (self.summary.error_count, self.summary.warning_count) { - (0, 0) => h_stack().child(IconElement::new(Icon::Check).color(Color::Success)), + (0, 0) => h_stack().child( + IconElement::new(Icon::Check) + .size(IconSize::Small) + .color(Color::Success), + ), (0, warning_count) => h_stack() .gap_1() - .child(IconElement::new(Icon::ExclamationTriangle).color(Color::Warning)) - .child(Label::new(warning_count.to_string())), + .child( + IconElement::new(Icon::ExclamationTriangle) + .size(IconSize::Small) + .color(Color::Warning), + ) + .child(Label::new(warning_count.to_string()).size(LabelSize::Small)), (error_count, 0) => h_stack() .gap_1() - .child(IconElement::new(Icon::XCircle).color(Color::Error)) - .child(Label::new(error_count.to_string())), + .child( + IconElement::new(Icon::XCircle) + .size(IconSize::Small) + .color(Color::Error), + ) + .child(Label::new(error_count.to_string()).size(LabelSize::Small)), (error_count, warning_count) => h_stack() .gap_1() - .child(IconElement::new(Icon::XCircle).color(Color::Error)) - .child(Label::new(error_count.to_string())) - .child(IconElement::new(Icon::ExclamationTriangle).color(Color::Warning)) - .child(Label::new(warning_count.to_string())), + .child( + IconElement::new(Icon::XCircle) + .size(IconSize::Small) + .color(Color::Error), + ) + .child(Label::new(error_count.to_string()).size(LabelSize::Small)) + .child( + IconElement::new(Icon::ExclamationTriangle) + .size(IconSize::Small) + .color(Color::Warning), + ) + .child(Label::new(warning_count.to_string()).size(LabelSize::Small)), }; let status = if !self.in_progress_checks.is_empty() { - Some(Label::new("Checking…").into_any_element()) + Some( + Label::new("Checking…") + .size(LabelSize::Small) + .into_any_element(), + ) } else if let Some(diagnostic) = &self.current_diagnostic { let message = diagnostic.message.split('\n').next().unwrap().to_string(); Some( Button::new("diagnostic_message", message) + .label_size(LabelSize::Small) .tooltip(|cx| { Tooltip::for_action("Next Diagnostic", &editor::GoToDiagnostic, cx) }) diff --git a/crates/editor2/src/items.rs b/crates/editor2/src/items.rs index fc8f7dfbbfb5cefe7f6d91b1d4dfdc6adbc3a3d8..e0374d3d7307ce0972a94d66993e0b9df05750a0 100644 --- a/crates/editor2/src/items.rs +++ b/crates/editor2/src/items.rs @@ -1200,7 +1200,7 @@ impl Render for CursorPosition { write!(text, " ({} selected)", self.selected_count).unwrap(); } - el.child(Label::new(text)) + el.child(Label::new(text).size(LabelSize::Small)) }) } } diff --git a/crates/feedback2/src/deploy_feedback_button.rs b/crates/feedback2/src/deploy_feedback_button.rs index 3b28c64dc3a57c51937f636c1693ea779aa1bf0d..926a5d791e0550dd27c354a5cc6db3530518f189 100644 --- a/crates/feedback2/src/deploy_feedback_button.rs +++ b/crates/feedback2/src/deploy_feedback_button.rs @@ -31,6 +31,7 @@ impl Render for DeployFeedbackButton { .is_some(); IconButton::new("give-feedback", Icon::Envelope) .style(ui::ButtonStyle::Subtle) + .icon_size(IconSize::Small) .selected(is_open) .tooltip(|cx| Tooltip::text("Share Feedback", cx)) .on_click(|_, cx| { diff --git a/crates/language_selector2/src/active_buffer_language.rs b/crates/language_selector2/src/active_buffer_language.rs index 4034cb04297e5ce6ab0db036a776a0edc111ebae..48224198a2e13a1651102a7e26253b0a7b6568bb 100644 --- a/crates/language_selector2/src/active_buffer_language.rs +++ b/crates/language_selector2/src/active_buffer_language.rs @@ -3,7 +3,7 @@ use gpui::{ div, Div, IntoElement, ParentElement, Render, Subscription, View, ViewContext, WeakView, }; use std::sync::Arc; -use ui::{Button, ButtonCommon, Clickable, Tooltip}; +use ui::{Button, ButtonCommon, Clickable, LabelSize, Tooltip}; use workspace::{item::ItemHandle, StatusItemView, Workspace}; use crate::LanguageSelector; @@ -50,6 +50,7 @@ impl Render for ActiveBufferLanguage { el.child( Button::new("change-language", active_language_text) + .label_size(LabelSize::Small) .on_click(cx.listener(|this, _, cx| { if let Some(workspace) = this.workspace.upgrade() { workspace.update(cx, |workspace, cx| { diff --git a/crates/vim2/src/mode_indicator.rs b/crates/vim2/src/mode_indicator.rs index 8c831ba797243a219b0cdf0730acb3caf4d0e0d4..f3b16e68ae0bdd2d6f933bf9909e96d8f9608374 100644 --- a/crates/vim2/src/mode_indicator.rs +++ b/crates/vim2/src/mode_indicator.rs @@ -1,6 +1,6 @@ -use gpui::{div, AnyElement, Element, IntoElement, Render, Subscription, ViewContext}; +use gpui::{div, AnyElement, Element, Render, Subscription, ViewContext}; use settings::SettingsStore; -use workspace::{item::ItemHandle, ui::Label, StatusItemView}; +use workspace::{item::ItemHandle, ui::prelude::*, StatusItemView}; use crate::{state::Mode, Vim}; @@ -61,7 +61,7 @@ impl Render for ModeIndicator { Mode::VisualLine => "-- VISUAL LINE --", Mode::VisualBlock => "-- VISUAL BLOCK --", }; - Label::new(text).into_any_element() + Label::new(text).size(LabelSize::Small).into_any_element() } } diff --git a/crates/workspace2/src/dock.rs b/crates/workspace2/src/dock.rs index e59d7ee49492e8361223d6d3ccf8457913cf965b..6f17d77fef8ead496a164b4aeaee0e150fdb9533 100644 --- a/crates/workspace2/src/dock.rs +++ b/crates/workspace2/src/dock.rs @@ -637,6 +637,7 @@ impl Render for PanelButtons { .attach(menu_attach) .trigger( IconButton::new(name, icon) + .icon_size(IconSize::Small) .selected(is_active_button) .on_click({ let action = action.boxed_clone();