diff --git a/crates/workspace/src/nav.rs b/crates/workspace/src/nav.rs index b01c89b6..45c14b8c 100644 --- a/crates/workspace/src/nav.rs +++ b/crates/workspace/src/nav.rs @@ -19,6 +19,7 @@ pub struct Nav { suffix: Option, selected: bool, clickable: bool, + gap: bool, #[allow(clippy::type_complexity)] on_click: Option>, } @@ -38,6 +39,7 @@ impl Nav { suffix: None, selected: false, clickable: false, + gap: true, on_click: None, } } @@ -48,6 +50,12 @@ impl Nav { self } + /// Whether to space the row's contents apart. + pub fn gap(mut self, gap: bool) -> Self { + self.gap = gap; + self + } + /// Sets the element shown before the label, such as an avatar or icon. pub fn prefix(mut self, prefix: impl IntoElement) -> Self { self.prefix = Some(prefix.into_any_element()); @@ -107,9 +115,17 @@ impl RenderOnce for Nav { .h_8() .w_full() .px_2() - .gap_2() + .when(self.gap, |this| this.gap_2()) .rounded(cx.theme().radius) - .when_some(self.prefix, |this, prefix| this.child(prefix)) + .when_some(self.prefix, |this, prefix| { + this.child( + h_flex() + .w_6() + .flex_shrink_0() + .justify_center() + .child(prefix), + ) + }) .child(div().flex_1().min_w_0().truncate().child(self.label)) .when_some(self.suffix, |this, suffix| { this.child(div().flex_shrink_0().child(suffix)) diff --git a/crates/workspace/src/panels/browse.rs b/crates/workspace/src/panels/browse.rs index 09ea0fa0..db9073b9 100644 --- a/crates/workspace/src/panels/browse.rs +++ b/crates/workspace/src/panels/browse.rs @@ -297,7 +297,7 @@ impl BrowsePanel { .px_1() .rounded(cx.theme().radius) .bg(cx.theme().sidebar) - .child(Input::new(&self.input).appearance(false).small().flex_1()) + .child(Input::new(&self.input).appearance(false).flex_1()) .child( Button::new("relay-browse") .icon(IconName::ArrowRight) diff --git a/crates/workspace/src/sidebar/group_view.rs b/crates/workspace/src/sidebar/group_view.rs index f988b36c..afa949e1 100644 --- a/crates/workspace/src/sidebar/group_view.rs +++ b/crates/workspace/src/sidebar/group_view.rs @@ -7,7 +7,6 @@ use gpui::{ ParentElement, SharedString, Styled, WeakEntity, div, relative, uniform_list, }; use gpui_kit::base::StyledExt as _; -use gpui_kit::component::button::{Button, ButtonVariants}; use gpui_kit::component::menu::{ContextMenuExt as _, PopupMenuItem}; use gpui_kit::component::{ActiveTheme, Icon, Sizable, h_flex, v_flex}; use nip29::Group; @@ -146,24 +145,13 @@ impl Sidebar { .gap_2() .child( h_flex() - .px_2() + .px_4() .flex_shrink_0() .justify_between() .child( h_flex() - .pl_0p5() .gap_1() .flex_shrink_1() - .child( - Button::new("sidebar-back") - .icon(IconName::ArrowLeft) - .tooltip("Back") - .ghost() - .small() - .on_click(cx.listener(|this, _event, _window, cx| { - this.hide_group(cx); - })), - ) .child(Avatar::new(picture).seed(seed.clone()).small()) .child( v_flex() @@ -283,19 +271,19 @@ impl Sidebar { let nav = Nav::new(public_key.to_hex()) .label(person.name()) - .text_xs() - .font_medium() + .text_sm() .clickable(true) .when(!hide_avatar, |this| { this.prefix( Avatar::new(person.avatar()) .seed(person.avatar_seed()) - .xsmall(), + .small(), ) }) .when(!roles.is_empty(), |this| { this.suffix( div() + .font_normal() .truncate() .text_xs() .text_color(cx.theme().muted_foreground) diff --git a/crates/workspace/src/sidebar/header.rs b/crates/workspace/src/sidebar/header.rs index 8be0cf21..c6b6b186 100644 --- a/crates/workspace/src/sidebar/header.rs +++ b/crates/workspace/src/sidebar/header.rs @@ -104,7 +104,19 @@ impl Sidebar { Box::new(Command::NewChat), ) }), - ), + ) + .when(self.group_open, |this| { + this.child( + Button::new("sidebar-back") + .icon(IconName::ArrowLeft) + .tooltip("Back") + .ghost() + .small() + .on_click(cx.listener(|this, _event, _window, cx| { + this.hide_group(cx); + })), + ) + }), ) } diff --git a/crates/workspace/src/sidebar/list.rs b/crates/workspace/src/sidebar/list.rs index 97dc8ed5..fa87c310 100644 --- a/crates/workspace/src/sidebar/list.rs +++ b/crates/workspace/src/sidebar/list.rs @@ -84,7 +84,6 @@ impl Sidebar { this.suffix( h_flex() .gap_1() - .items_center() .child( h_flex() .py_0p5() @@ -120,6 +119,7 @@ impl Sidebar { Nav::new("contacts") .prefix(Icon::new(IconName::Book).small()) .label("Contacts") + .gap(false) .text_sm() .when(contacts_open, |this| this.bg(cx.theme().list_active)) .on_click(cx.listener(|this, _event, window, cx| { diff --git a/crates/workspace/src/sidebar/onboarding.rs b/crates/workspace/src/sidebar/onboarding.rs index 733022f4..15fc4b54 100644 --- a/crates/workspace/src/sidebar/onboarding.rs +++ b/crates/workspace/src/sidebar/onboarding.rs @@ -2,7 +2,7 @@ use std::time::{SystemTime, UNIX_EPOCH}; use gpui::{AnyElement, App, IntoElement, ParentElement, SharedString, Styled, Window, img}; use gpui_kit::component::button::{Button, ButtonVariants}; -use gpui_kit::component::{Sizable, v_flex}; +use gpui_kit::component::v_flex; use crate::dialogs::import; @@ -32,7 +32,6 @@ pub(super) fn render_signed_out(_window: &mut Window, _cx: &mut App) -> AnyEleme Button::new("import") .label("Import Identity") .primary() - .large() .on_click(|_, window, cx| { import::open(window, cx); }), diff --git a/crates/workspace/src/sidebar/search.rs b/crates/workspace/src/sidebar/search.rs index 4f2e89be..7024a4c9 100644 --- a/crates/workspace/src/sidebar/search.rs +++ b/crates/workspace/src/sidebar/search.rs @@ -205,6 +205,7 @@ impl Sidebar { pub(super) fn render_find(&self, cx: &mut Context) -> AnyElement { h_flex() + .mb_2() .px_2() .flex_shrink_0() .w_full() @@ -214,8 +215,8 @@ impl Sidebar { .gap_1() .w_full() .rounded(cx.theme().radius) - .bg(cx.theme().secondary) - .child(Input::new(&self.find_input).appearance(false).small()) + .bg(cx.theme().input_background()) + .child(Input::new(&self.find_input).appearance(false)) .child( Button::new("sidebar-global") .icon(IconName::Compass) @@ -224,7 +225,7 @@ impl Sidebar { } else { "Enable global search" }) - .small() + .xsmall() .ghost() .selected(self.global_open) .loading(self.global_finding)