Refine status bar design (#34324)
Experimenting with a set of standardized icons and polishing spacing a little bit. Release Notes: - N/A
This commit is contained in:
parent
e070c81687
commit
46834d31f1
13 changed files with 59 additions and 38 deletions
|
@ -247,6 +247,7 @@ pub enum IconName {
|
|||
SwatchBook,
|
||||
Tab,
|
||||
Terminal,
|
||||
TerminalAlt,
|
||||
TextSnippet,
|
||||
ThumbsDown,
|
||||
ThumbsUp,
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
use editor::EditorSettings;
|
||||
use settings::Settings as _;
|
||||
use ui::{
|
||||
ButtonCommon, ButtonLike, Clickable, Color, Context, Icon, IconName, IconSize, ParentElement,
|
||||
Render, Styled, Tooltip, Window, h_flex,
|
||||
};
|
||||
use ui::{ButtonCommon, Clickable, Context, Render, Tooltip, Window, prelude::*};
|
||||
use workspace::{ItemHandle, StatusItemView};
|
||||
|
||||
pub struct SearchButton;
|
||||
|
@ -16,18 +13,15 @@ impl SearchButton {
|
|||
|
||||
impl Render for SearchButton {
|
||||
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl ui::IntoElement {
|
||||
let button = h_flex().gap_2();
|
||||
let button = div();
|
||||
|
||||
if !EditorSettings::get_global(cx).search.button {
|
||||
return button;
|
||||
return button.w_0().invisible();
|
||||
}
|
||||
|
||||
button.child(
|
||||
ButtonLike::new("project-search-indicator")
|
||||
.child(
|
||||
Icon::new(IconName::MagnifyingGlass)
|
||||
.size(IconSize::Small)
|
||||
.color(Color::Default),
|
||||
)
|
||||
IconButton::new("project-search-indicator", IconName::MagnifyingGlass)
|
||||
.icon_size(IconSize::Small)
|
||||
.tooltip(|window, cx| {
|
||||
Tooltip::for_action(
|
||||
"Project Search",
|
||||
|
|
|
@ -1437,7 +1437,7 @@ impl Panel for TerminalPanel {
|
|||
if (self.is_enabled(cx) || !self.has_no_terminals(cx))
|
||||
&& TerminalSettings::get_global(cx).button
|
||||
{
|
||||
Some(IconName::Terminal)
|
||||
Some(IconName::TerminalAlt)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
|
|
@ -69,8 +69,7 @@ impl RenderOnce for ProgressBar {
|
|||
.w_full()
|
||||
.h(px(8.0))
|
||||
.rounded_full()
|
||||
.py(px(2.0))
|
||||
.px(px(4.0))
|
||||
.p(px(2.0))
|
||||
.bg(self.bg_color)
|
||||
.shadow(vec![gpui::BoxShadow {
|
||||
color: gpui::black().opacity(0.08),
|
||||
|
|
|
@ -221,9 +221,9 @@ pub enum DockPosition {
|
|||
impl DockPosition {
|
||||
fn label(&self) -> &'static str {
|
||||
match self {
|
||||
Self::Left => "left",
|
||||
Self::Bottom => "bottom",
|
||||
Self::Right => "right",
|
||||
Self::Left => "Left",
|
||||
Self::Bottom => "Bottom",
|
||||
Self::Right => "Right",
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -864,7 +864,7 @@ impl Render for PanelButtons {
|
|||
let action = dock.toggle_action();
|
||||
|
||||
let tooltip: SharedString =
|
||||
format!("Close {} dock", dock.position.label()).into();
|
||||
format!("Close {} Dock", dock.position.label()).into();
|
||||
|
||||
(action, tooltip)
|
||||
} else {
|
||||
|
@ -923,6 +923,7 @@ impl Render for PanelButtons {
|
|||
.collect();
|
||||
|
||||
let has_buttons = !buttons.is_empty();
|
||||
|
||||
h_flex()
|
||||
.gap_1()
|
||||
.children(buttons)
|
||||
|
|
|
@ -42,7 +42,7 @@ impl Render for StatusBar {
|
|||
.justify_between()
|
||||
.gap(DynamicSpacing::Base08.rems(cx))
|
||||
.py(DynamicSpacing::Base04.rems(cx))
|
||||
.px(DynamicSpacing::Base08.rems(cx))
|
||||
.px(DynamicSpacing::Base06.rems(cx))
|
||||
.bg(cx.theme().colors().status_bar_background)
|
||||
.map(|el| match window.window_decorations() {
|
||||
Decorations::Server => el,
|
||||
|
@ -58,22 +58,23 @@ impl Render for StatusBar {
|
|||
.border_b(px(1.0))
|
||||
.border_color(cx.theme().colors().status_bar_background),
|
||||
})
|
||||
.child(self.render_left_tools(cx))
|
||||
.child(self.render_right_tools(cx))
|
||||
.child(self.render_left_tools())
|
||||
.child(self.render_right_tools())
|
||||
}
|
||||
}
|
||||
|
||||
impl StatusBar {
|
||||
fn render_left_tools(&self, cx: &mut Context<Self>) -> impl IntoElement {
|
||||
fn render_left_tools(&self) -> impl IntoElement {
|
||||
h_flex()
|
||||
.gap(DynamicSpacing::Base04.rems(cx))
|
||||
.gap_1()
|
||||
.overflow_x_hidden()
|
||||
.children(self.left_items.iter().map(|item| item.to_any()))
|
||||
}
|
||||
|
||||
fn render_right_tools(&self, cx: &mut Context<Self>) -> impl IntoElement {
|
||||
fn render_right_tools(&self) -> impl IntoElement {
|
||||
h_flex()
|
||||
.gap(DynamicSpacing::Base04.rems(cx))
|
||||
.gap_1()
|
||||
.overflow_x_hidden()
|
||||
.children(self.right_items.iter().rev().map(|item| item.to_any()))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue