Collapsed rail 56 px with a 34 px logo and avatar, logo mark cropped to the needle so it fills its box
Browse files at this commita4b71d1737f104860ffc8bad8eb9b788680b7ca4Parent: 505243d- style
- collapsed rail 56 px with a 34 px logo and avatar, logo mark cropped to the needle so it fills its box
3 changed files +15 -12
- crates/client/design/tokens.toml +1 -0
- crates/client/src/gui/sidebar.rs +10 -9
- crates/client/src/logo.rs +4 -3
crates/client/design/tokens.tomlmodified+1 -0
| @@ -65,6 +65,7 @@ control_sm = 26 | |||
| 65 | control = 34 | 65 | control = 34 |
| 66 | row = 44 | 66 | row = 44 |
| 67 | avatar = 26 | 67 | avatar = 26 |
| 68 | +rail = 56 | ||
| 68 | avatar_lg = 64 | 69 | avatar_lg = 64 |
| 69 | thumb = 120 | 70 | thumb = 120 |
| 70 | sidebar = 230 | 71 | sidebar = 230 |
crates/client/src/gui/sidebar.rsmodified+10 -9
| @@ -32,7 +32,6 @@ use super::{ | |||
| 32 | widget::{bare_input, compact_frame, icon_button}, | 32 | widget::{bare_input, compact_frame, icon_button}, |
| 33 | }; | 33 | }; |
| 34 | 34 | ||
| 35 | -const RAIL: f32 = size::AVATAR + space::XS * 2.; | ||
| 36 | const SLIDE: std::time::Duration = std::time::Duration::from_millis(320); | 35 | const SLIDE: std::time::Duration = std::time::Duration::from_millis(320); |
| 37 | 36 | ||
| 38 | fn slide() -> gpui_kit::Animation { | 37 | fn slide() -> gpui_kit::Animation { |
| @@ -43,9 +42,9 @@ impl Yumush { | |||
| 43 | pub(super) fn sidebar(&self, entity: &Entity<Self>, palette: Palette) -> impl IntoElement { | 42 | pub(super) fn sidebar(&self, entity: &Entity<Self>, palette: Palette) -> impl IntoElement { |
| 44 | let collapsed = self.chat.sidebar_collapsed; | 43 | let collapsed = self.chat.sidebar_collapsed; |
| 45 | let (from, to, id) = if collapsed { | 44 | let (from, to, id) = if collapsed { |
| 46 | - (size::SIDEBAR, RAIL, "sidebar_collapsing") | 45 | + (size::SIDEBAR, size::RAIL, "sidebar_collapsing") |
| 47 | } else { | 46 | } else { |
| 48 | - (RAIL, size::SIDEBAR, "sidebar_expanding") | 47 | + (size::RAIL, size::SIDEBAR, "sidebar_expanding") |
| 49 | }; | 48 | }; |
| 50 | let content = if collapsed { | 49 | let content = if collapsed { |
| 51 | self.collapsed_sidebar(entity, palette).into_any_element() | 50 | self.collapsed_sidebar(entity, palette).into_any_element() |
| @@ -71,7 +70,7 @@ impl Yumush { | |||
| 71 | fn collapsed_sidebar(&self, entity: &Entity<Self>, palette: Palette) -> Div { | 70 | fn collapsed_sidebar(&self, entity: &Entity<Self>, palette: Palette) -> Div { |
| 72 | div() | 71 | div() |
| 73 | .h_full() | 72 | .h_full() |
| 74 | - .w(px(RAIL)) | 73 | + .w(px(size::RAIL)) |
| 75 | .flex() | 74 | .flex() |
| 76 | .flex_col() | 75 | .flex_col() |
| 77 | .items_center() | 76 | .items_center() |
| @@ -83,7 +82,7 @@ impl Yumush { | |||
| 83 | .flex_col() | 82 | .flex_col() |
| 84 | .items_center() | 83 | .items_center() |
| 85 | .gap(px(space::MD)) | 84 | .gap(px(space::MD)) |
| 86 | - .child(logo_mark(palette)) | 85 | + .child(logo_mark(palette).size(px(size::CONTROL))) |
| 87 | .child(self.collapse_button(entity, palette)), | 86 | .child(self.collapse_button(entity, palette)), |
| 88 | ) | 87 | ) |
| 89 | .child( | 88 | .child( |
| @@ -999,6 +998,7 @@ impl Yumush { | |||
| 999 | named: bool, | 998 | named: bool, |
| 1000 | palette: Palette, | 999 | palette: Palette, |
| 1001 | ) -> impl IntoElement { | 1000 | ) -> impl IntoElement { |
| 1001 | + let face = if named { size::AVATAR } else { size::CONTROL }; | ||
| 1002 | profile_popover( | 1002 | profile_popover( |
| 1003 | "account_profile", | 1003 | "account_profile", |
| 1004 | Anchor::BottomLeft, | 1004 | Anchor::BottomLeft, |
| @@ -1009,20 +1009,21 @@ impl Yumush { | |||
| 1009 | div() | 1009 | div() |
| 1010 | .flex() | 1010 | .flex() |
| 1011 | .items_center() | 1011 | .items_center() |
| 1012 | - .h(px(size::CONTROL)) | 1012 | + .when(named, |trigger| trigger.h(px(size::CONTROL))) |
| 1013 | .gap(px(space::SM)) | 1013 | .gap(px(space::SM)) |
| 1014 | - .px(px(if named { space::SM } else { space::XXS })) | 1014 | + .p(px(if named { 0. } else { space::XXS })) |
| 1015 | + .when(named, |trigger| trigger.px(px(space::SM))) | ||
| 1015 | .rounded(px(radius::MD)) | 1016 | .rounded(px(radius::MD)) |
| 1016 | .child(presence_avatar( | 1017 | .child(presence_avatar( |
| 1017 | avatar( | 1018 | avatar( |
| 1018 | palette, | 1019 | palette, |
| 1019 | user, | 1020 | user, |
| 1020 | - px(size::AVATAR), | 1021 | + px(face), |
| 1021 | text(text::CAPTION), | 1022 | text(text::CAPTION), |
| 1022 | &self.chat.avatars, | 1023 | &self.chat.avatars, |
| 1023 | ), | 1024 | ), |
| 1024 | self.presence_of(user.id), | 1025 | self.presence_of(user.id), |
| 1025 | - px(size::AVATAR), | 1026 | + px(face), |
| 1026 | palette, | 1027 | palette, |
| 1027 | )) | 1028 | )) |
| 1028 | .when(named, |trigger| { | 1029 | .when(named, |trigger| { |
crates/client/src/logo.rsmodified+4 -3
| @@ -4,18 +4,19 @@ use gpui_kit::{AssetSource, SharedString, assets::AllAssets}; | |||
| 4 | 4 | ||
| 5 | pub const PATH: &str = "yumush/logo.svg"; | 5 | pub const PATH: &str = "yumush/logo.svg"; |
| 6 | 6 | ||
| 7 | -fn svg(background: &str, needle: &str, thread: &str) -> String { | 7 | +fn svg(view: &str, background: &str, needle: &str, thread: &str) -> String { |
| 8 | format!( | 8 | format!( |
| 9 | - r##"<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 100 100">{background}<mask id="eye"><rect width="100" height="100" fill="#fff"/><ellipse cx="68" cy="27.5" rx="2.2" ry="5" transform="rotate(39 68 27.5)" fill="#000"/></mask><path d="M26 80 L74 20" stroke="{needle}" stroke-width="7" stroke-linecap="round" mask="url(#eye)"/><path d="M68 28 C80 40 76 56 60 58 C44 60 40 74 52 84" fill="none" stroke="{thread}" stroke-width="5" stroke-linecap="round"/></svg>"## | 9 | + r##"<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="{view}">{background}<mask id="eye"><rect width="100" height="100" fill="#fff"/><ellipse cx="68" cy="27.5" rx="2.2" ry="5" transform="rotate(39 68 27.5)" fill="#000"/></mask><path d="M26 80 L74 20" stroke="{needle}" stroke-width="7" stroke-linecap="round" mask="url(#eye)"/><path d="M68 28 C80 40 76 56 60 58 C44 60 40 74 52 84" fill="none" stroke="{thread}" stroke-width="5" stroke-linecap="round"/></svg>"## |
| 10 | ) | 10 | ) |
| 11 | } | 11 | } |
| 12 | 12 | ||
| 13 | pub fn mark() -> String { | 13 | pub fn mark() -> String { |
| 14 | - svg("", "#000", "#000") | 14 | + svg("14 12 76 76", "", "#000", "#000") |
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | pub fn icon() -> String { | 17 | pub fn icon() -> String { |
| 18 | svg( | 18 | svg( |
| 19 | + "0 0 100 100", | ||
| 19 | r##"<rect width="100" height="100" rx="23" fill="#121527"/>"##, | 20 | r##"<rect width="100" height="100" rx="23" fill="#121527"/>"##, |
| 20 | "#ece5d8", | 21 | "#ece5d8", |
| 21 | "#ffb36b", | 22 | "#ffb36b", |