From 6e11044e9ef6ce20d7db0a4eacfa60ebac7c94f3 Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Wed, 8 Nov 2023 12:57:24 -0500 Subject: [PATCH 1/8] add `ui_text_size` functions --- crates/ui2/src/components/label.rs | 4 ++-- crates/ui2/src/prelude.rs | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/crates/ui2/src/components/label.rs b/crates/ui2/src/components/label.rs index dd078d2331305dcfd87a66a52c290b0bfe8cb1fa..3346d7835a289ca7b0c950b103e4efbc4b6b832b 100644 --- a/crates/ui2/src/components/label.rs +++ b/crates/ui2/src/components/label.rs @@ -1,4 +1,4 @@ -use gpui::{relative, rems, Hsla, WindowContext}; +use gpui::{relative, Hsla, WindowContext}; use smallvec::SmallVec; use crate::prelude::*; @@ -85,7 +85,7 @@ impl Label { .bg(LabelColor::Hidden.hsla(cx)), ) }) - .text_size(rems(1.)) + .text_size(ui_text_default()) .when(self.line_height_style == LineHeightStyle::UILabel, |this| { this.line_height(relative(1.)) }) diff --git a/crates/ui2/src/prelude.rs b/crates/ui2/src/prelude.rs index 3f179210eb3fc5c8329ea3cde110f2f5b33e7ee0..fc0adadb9cd890863a7fdf05988ab2e797c32864 100644 --- a/crates/ui2/src/prelude.rs +++ b/crates/ui2/src/prelude.rs @@ -1,3 +1,5 @@ +use gpui::rems; +use gpui::Rems; pub use gpui::{ div, Component, Element, ElementId, ParentElement, SharedString, StatefulInteractive, StatelessInteractive, Styled, ViewContext, WindowContext, @@ -73,6 +75,24 @@ impl std::fmt::Display for GitStatus { } } +/// The default text size for UI text +/// +/// At a default 16px per rem, this is 14px. +/// +/// Use [`ui_text_sm`] for smaller text. +pub fn ui_text_default() -> Rems { + rems(0.875) +} + +/// The small text size for UI text +/// +/// At a default 16px per rem, this is 12px. +/// +/// Use [`ui_text_default`] for regular-sized text. +pub fn ui_text_sm() -> Rems { + rems(0.75) +} + #[derive(Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy, EnumIter)] pub enum DiagnosticStatus { #[default] From e4ca2cb20b8603197f9a9759b41562e30a972abf Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Wed, 8 Nov 2023 12:57:31 -0500 Subject: [PATCH 2/8] Update titlebar --- crates/workspace2/src/workspace2.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/crates/workspace2/src/workspace2.rs b/crates/workspace2/src/workspace2.rs index b51b0186efd4ab4bccd8822f407141a05eeb2b10..bc2c649637145f3594066e911c91d6232821322f 100644 --- a/crates/workspace2/src/workspace2.rs +++ b/crates/workspace2/src/workspace2.rs @@ -36,7 +36,7 @@ use futures::{ Future, FutureExt, StreamExt, }; use gpui::{ - div, point, size, AnyModel, AnyView, AnyWeakView, AppContext, AsyncAppContext, + div, point, rems, size, AnyModel, AnyView, AnyWeakView, AppContext, AsyncAppContext, AsyncWindowContext, Bounds, Component, Div, Entity, EntityId, EventEmitter, FocusHandle, GlobalPixels, Model, ModelContext, ParentElement, Point, Render, Size, StatefulInteractive, Styled, Subscription, Task, View, ViewContext, VisualContext, WeakView, WindowBounds, @@ -69,6 +69,7 @@ use std::{ }; use theme2::ActiveTheme; pub use toolbar::{ToolbarItemLocation, ToolbarItemView}; +use ui::{h_stack, Label}; use util::ResultExt; use uuid::Uuid; use workspace_settings::{AutosaveSetting, WorkspaceSettings}; @@ -2620,19 +2621,23 @@ impl Workspace { // } fn render_titlebar(&self, cx: &mut ViewContext) -> impl Component { - div() + h_stack() + .id("titlebar") + .justify_between() + .w_full() + .h(rems(1.75)) .bg(cx.theme().colors().title_bar_background) .when( !matches!(cx.window_bounds(), WindowBounds::Fullscreen), |s| s.pl_20(), ) - .id("titlebar") .on_click(|_, event, cx| { if event.up.click_count == 2 { cx.zoom_window(); } }) - .child("Collab title bar Item") // self.titlebar_item + .child(h_stack().child(Label::new("Left side titlebar item"))) // self.titlebar_item + .child(h_stack().child(Label::new("Right side titlebar item"))) } fn active_item_path_changed(&mut self, cx: &mut ViewContext) { From 6ecf629c63294414a4f0219613fdf2d417fd491b Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Wed, 8 Nov 2023 14:29:38 -0500 Subject: [PATCH 3/8] BROKEN: Checkpoint --- crates/ui2/src/components/label.rs | 4 ++- crates/ui2/src/lib.rs | 2 ++ crates/ui2/src/prelude.rs | 52 +++++++++++++++++++----------- crates/ui2/src/styled_ext.rs | 30 +++++++++++++++++ 4 files changed, 69 insertions(+), 19 deletions(-) create mode 100644 crates/ui2/src/styled_ext.rs diff --git a/crates/ui2/src/components/label.rs b/crates/ui2/src/components/label.rs index 3346d7835a289ca7b0c950b103e4efbc4b6b832b..827ba87918a0cd4dd3f3255c8b7852436ea06a79 100644 --- a/crates/ui2/src/components/label.rs +++ b/crates/ui2/src/components/label.rs @@ -2,6 +2,8 @@ use gpui::{relative, Hsla, WindowContext}; use smallvec::SmallVec; use crate::prelude::*; +use crate::styled_ext::StyledExt; + #[derive(Default, PartialEq, Copy, Clone)] pub enum LabelColor { #[default] @@ -85,7 +87,7 @@ impl Label { .bg(LabelColor::Hidden.hsla(cx)), ) }) - .text_size(ui_text_default()) + .text_ui() .when(self.line_height_style == LineHeightStyle::UILabel, |this| { this.line_height(relative(1.)) }) diff --git a/crates/ui2/src/lib.rs b/crates/ui2/src/lib.rs index 5fb39984387e7b5b76a7ca7152ed186303bc5463..149dcd3fd04bb8f21232fbe3ffd8deaa9d7bb440 100644 --- a/crates/ui2/src/lib.rs +++ b/crates/ui2/src/lib.rs @@ -19,12 +19,14 @@ mod elevation; pub mod prelude; pub mod settings; mod static_data; +mod styled_ext; mod to_extract; pub mod utils; pub use components::*; pub use prelude::*; pub use static_data::*; +pub use styled_ext::*; pub use to_extract::*; // This needs to be fully qualified with `crate::` otherwise we get a panic diff --git a/crates/ui2/src/prelude.rs b/crates/ui2/src/prelude.rs index fc0adadb9cd890863a7fdf05988ab2e797c32864..a99f84dcfe0a65ef2819afd9a380b61160910af6 100644 --- a/crates/ui2/src/prelude.rs +++ b/crates/ui2/src/prelude.rs @@ -12,6 +12,40 @@ pub use theme2::ActiveTheme; use gpui::Hsla; use strum::EnumIter; +#[derive(Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy, EnumIter)] +pub enum UITextSize { + #[default] + Default, + Small, +} + +impl UITextSize { + pub fn rems(self) -> Rems { + match self { + Self::Default => rems(0.875), + Self::Small => rems(0.75), + } + } +} + +/// The default text size for UI text +/// +/// At a default 16px per rem, this is 14px. +/// +/// Use [`ui_text_sm`] for smaller text. +pub fn ui_text_default() -> Rems { + rems(0.875) +} + +/// The small text size for UI text +/// +/// At a default 16px per rem, this is 12px. +/// +/// Use [`ui_text_default`] for regular-sized text. +pub fn ui_text_sm() -> Rems { + rems(0.75) +} + #[derive(Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy, EnumIter)] pub enum FileSystemStatus { #[default] @@ -75,24 +109,6 @@ impl std::fmt::Display for GitStatus { } } -/// The default text size for UI text -/// -/// At a default 16px per rem, this is 14px. -/// -/// Use [`ui_text_sm`] for smaller text. -pub fn ui_text_default() -> Rems { - rems(0.875) -} - -/// The small text size for UI text -/// -/// At a default 16px per rem, this is 12px. -/// -/// Use [`ui_text_default`] for regular-sized text. -pub fn ui_text_sm() -> Rems { - rems(0.75) -} - #[derive(Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy, EnumIter)] pub enum DiagnosticStatus { #[default] diff --git a/crates/ui2/src/styled_ext.rs b/crates/ui2/src/styled_ext.rs new file mode 100644 index 0000000000000000000000000000000000000000..70b2a072fc7f801a0fc997c3cf5fd1a1db89d694 --- /dev/null +++ b/crates/ui2/src/styled_ext.rs @@ -0,0 +1,30 @@ +use gpui::Styled; + +use crate::UITextSize; + +pub trait StyledExt: Styled { + fn text_ui_size(self, size: UITextSize) -> Self + where + Self: Sized, + { + let size = size.rems(); + + self.text_size(size) + } + fn text_ui(self) -> Self + where + Self: Sized, + { + let size = UITextSize::default().rems(); + + self.text_size(size) + } + fn text_ui_sm(self) -> Self + where + Self: Sized, + { + let size = UITextSize::Small.rems(); + + self.text_size(size) + } +} From 4ef2f0b2b9a1ff6097b0e50252a17459b428a7ca Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Wed, 8 Nov 2023 14:42:56 -0500 Subject: [PATCH 4/8] Update StyledExt to use more idiomatic method naming --- crates/ui2/src/prelude.rs | 28 +++++++++---------------- crates/ui2/src/styled_ext.rs | 40 +++++++++++++++++++++++------------- 2 files changed, 36 insertions(+), 32 deletions(-) diff --git a/crates/ui2/src/prelude.rs b/crates/ui2/src/prelude.rs index a99f84dcfe0a65ef2819afd9a380b61160910af6..0f0a22268e5ab271299c575d4a37b4e2f495ff87 100644 --- a/crates/ui2/src/prelude.rs +++ b/crates/ui2/src/prelude.rs @@ -14,8 +14,18 @@ use strum::EnumIter; #[derive(Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy, EnumIter)] pub enum UITextSize { + /// The default size for UI text. + /// + /// `0.825rem` or `14px` at the default scale of `1rem` = `16px`. + /// + /// Note: The absolute size of this text will change based on a user's `ui_scale` setting. #[default] Default, + /// The small size for UI text. + /// + /// `0.75rem` or `12px` at the default scale of `1rem` = `16px`. + /// + /// Note: The absolute size of this text will change based on a user's `ui_scale` setting. Small, } @@ -28,24 +38,6 @@ impl UITextSize { } } -/// The default text size for UI text -/// -/// At a default 16px per rem, this is 14px. -/// -/// Use [`ui_text_sm`] for smaller text. -pub fn ui_text_default() -> Rems { - rems(0.875) -} - -/// The small text size for UI text -/// -/// At a default 16px per rem, this is 12px. -/// -/// Use [`ui_text_default`] for regular-sized text. -pub fn ui_text_sm() -> Rems { - rems(0.75) -} - #[derive(Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy, EnumIter)] pub enum FileSystemStatus { #[default] diff --git a/crates/ui2/src/styled_ext.rs b/crates/ui2/src/styled_ext.rs index 70b2a072fc7f801a0fc997c3cf5fd1a1db89d694..f082ea93a5cb5487a0925d16d338e0eed84b52a2 100644 --- a/crates/ui2/src/styled_ext.rs +++ b/crates/ui2/src/styled_ext.rs @@ -1,28 +1,40 @@ -use gpui::Styled; +use gpui::{Div, Styled}; use crate::UITextSize; -pub trait StyledExt: Styled { - fn text_ui_size(self, size: UITextSize) -> Self - where - Self: Sized, - { +/// Extends [`Styled`](gpui::Styled) with Zed specific styling methods. +pub trait StyledExt { + fn text_ui_size(self, size: UITextSize) -> Self; + fn text_ui(self) -> Self; + fn text_ui_sm(self) -> Self; +} + +impl StyledExt for Div { + fn text_ui_size(self, size: UITextSize) -> Self { let size = size.rems(); self.text_size(size) } - fn text_ui(self) -> Self - where - Self: Sized, - { + /// The default size for UI text. + /// + /// `0.825rem` or `14px` at the default scale of `1rem` = `16px`. + /// + /// Note: The absolute size of this text will change based on a user's `ui_scale` setting. + /// + /// Use [`text_ui_sm`] for regular-sized text. + fn text_ui(self) -> Self { let size = UITextSize::default().rems(); self.text_size(size) } - fn text_ui_sm(self) -> Self - where - Self: Sized, - { + /// The small size for UI text. + /// + /// `0.75rem` or `12px` at the default scale of `1rem` = `16px`. + /// + /// Note: The absolute size of this text will change based on a user's `ui_scale` setting. + /// + /// Use [`text_ui`] for regular-sized text. + fn text_ui_sm(self) -> Self { let size = UITextSize::Small.rems(); self.text_size(size) From cb830a4ce01e0026cd3b2bb7539e88d80f761a66 Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Wed, 8 Nov 2023 14:46:47 -0500 Subject: [PATCH 5/8] Remove unused code in `avatar` --- crates/ui2/src/components/avatar.rs | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/crates/ui2/src/components/avatar.rs b/crates/ui2/src/components/avatar.rs index 9c993dfc062c2df288c5345c8bcc4019cd11d6a4..d083d8fd463e144e236e5c625caa92f237f3fce4 100644 --- a/crates/ui2/src/components/avatar.rs +++ b/crates/ui2/src/components/avatar.rs @@ -61,23 +61,6 @@ mod stories { .child(Avatar::new( "https://avatars.githubusercontent.com/u/326587?v=4", )) - // .child(Avatar::new( - // "https://avatars.githubusercontent.com/u/326587?v=4", - // )) - // .child(Avatar::new( - // "https://avatars.githubusercontent.com/u/482957?v=4", - // )) - // .child(Avatar::new( - // "https://avatars.githubusercontent.com/u/1714999?v=4", - // )) - // .child(Avatar::new( - // "https://avatars.githubusercontent.com/u/1486634?v=4", - // )) - .child(Story::label(cx, "Rounded rectangle")) - // .child( - // Avatar::new("https://avatars.githubusercontent.com/u/1714999?v=4") - // .shape(Shape::RoundedRectangle), - // ) } } } From f4abd95866b0968996b38ac9370a9d5e76554ec9 Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Wed, 8 Nov 2023 15:00:47 -0500 Subject: [PATCH 6/8] Remove the Stack trait, update StyledExt to include stacks Co-Authored-By: Marshall Bowers <1486634+maxdeviant@users.noreply.github.com> --- crates/ui2/src/components/stack.rs | 20 ++----------- crates/ui2/src/styled_ext.rs | 45 ++++++++++++++++++++++++------ 2 files changed, 39 insertions(+), 26 deletions(-) diff --git a/crates/ui2/src/components/stack.rs b/crates/ui2/src/components/stack.rs index d7bd0eb04f23b67b0797d86ba04fe3f4ee818b84..d3d7a75aa76b8765a97b3dcc0c92c498cbbb7d24 100644 --- a/crates/ui2/src/components/stack.rs +++ b/crates/ui2/src/components/stack.rs @@ -1,31 +1,17 @@ use gpui::{div, Div}; -use crate::prelude::*; - -pub trait Stack: Styled + Sized { - /// Horizontally stacks elements. - fn h_stack(self) -> Self { - self.flex().flex_row().items_center() - } - - /// Vertically stacks elements. - fn v_stack(self) -> Self { - self.flex().flex_col() - } -} - -impl Stack for Div {} +use crate::StyledExt; /// Horizontally stacks elements. /// /// Sets `flex()`, `flex_row()`, `items_center()` pub fn h_stack() -> Div { - div().h_stack() + div().h_flex() } /// Vertically stacks elements. /// /// Sets `flex()`, `flex_col()` pub fn v_stack() -> Div { - div().v_stack() + div().v_flex() } diff --git a/crates/ui2/src/styled_ext.rs b/crates/ui2/src/styled_ext.rs index f082ea93a5cb5487a0925d16d338e0eed84b52a2..0c674d5c3c2cac85e3591291ed10297bffe8ffe3 100644 --- a/crates/ui2/src/styled_ext.rs +++ b/crates/ui2/src/styled_ext.rs @@ -3,18 +3,36 @@ use gpui::{Div, Styled}; use crate::UITextSize; /// Extends [`Styled`](gpui::Styled) with Zed specific styling methods. -pub trait StyledExt { - fn text_ui_size(self, size: UITextSize) -> Self; - fn text_ui(self) -> Self; - fn text_ui_sm(self) -> Self; -} +pub trait StyledExt: Styled { + /// Horizontally stacks elements. + /// + /// Sets `flex()`, `flex_row()`, `items_center()` + fn h_flex(self) -> Self + where + Self: Sized, + { + self.flex().flex_row().items_center() + } -impl StyledExt for Div { - fn text_ui_size(self, size: UITextSize) -> Self { + /// Vertically stacks elements. + /// + /// Sets `flex()`, `flex_col()` + fn v_flex(self) -> Self + where + Self: Sized, + { + self.flex().flex_col() + } + + fn text_ui_size(self, size: UITextSize) -> Self + where + Self: Sized, + { let size = size.rems(); self.text_size(size) } + /// The default size for UI text. /// /// `0.825rem` or `14px` at the default scale of `1rem` = `16px`. @@ -22,11 +40,15 @@ impl StyledExt for Div { /// Note: The absolute size of this text will change based on a user's `ui_scale` setting. /// /// Use [`text_ui_sm`] for regular-sized text. - fn text_ui(self) -> Self { + fn text_ui(self) -> Self + where + Self: Sized, + { let size = UITextSize::default().rems(); self.text_size(size) } + /// The small size for UI text. /// /// `0.75rem` or `12px` at the default scale of `1rem` = `16px`. @@ -34,9 +56,14 @@ impl StyledExt for Div { /// Note: The absolute size of this text will change based on a user's `ui_scale` setting. /// /// Use [`text_ui`] for regular-sized text. - fn text_ui_sm(self) -> Self { + fn text_ui_sm(self) -> Self + where + Self: Sized, + { let size = UITextSize::Small.rems(); self.text_size(size) } } + +impl StyledExt for Div {} From 9bdfc7a2e5903994762a62f9397fefb52e795aaf Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Wed, 8 Nov 2023 15:25:44 -0500 Subject: [PATCH 7/8] Update StyledExt to impl over I & F as well as V for Div Co-Authored-By: Marshall Bowers <1486634+maxdeviant@users.noreply.github.com> --- crates/ui2/src/styled_ext.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/crates/ui2/src/styled_ext.rs b/crates/ui2/src/styled_ext.rs index 0c674d5c3c2cac85e3591291ed10297bffe8ffe3..543781ef526552df35bb42b16dee09f051cfeb94 100644 --- a/crates/ui2/src/styled_ext.rs +++ b/crates/ui2/src/styled_ext.rs @@ -1,4 +1,4 @@ -use gpui::{Div, Styled}; +use gpui::{Div, ElementFocus, ElementInteractivity, Styled}; use crate::UITextSize; @@ -66,4 +66,9 @@ pub trait StyledExt: Styled { } } -impl StyledExt for Div {} +impl StyledExt for Div +where + I: ElementInteractivity, + F: ElementFocus, +{ +} From 9cc3ee9674c374c519c7bf9c7f35e43272f917ff Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Wed, 8 Nov 2023 15:28:38 -0500 Subject: [PATCH 8/8] Update usages of `text_size_*` to `text_ui` in ui components Co-Authored-By: Marshall Bowers <1486634+maxdeviant@users.noreply.github.com> --- crates/ui2/src/components/button.rs | 14 ++++++++------ crates/ui2/src/components/details.rs | 2 +- crates/ui2/src/components/icon_button.rs | 1 + crates/ui2/src/components/input.rs | 2 +- crates/ui2/src/components/keybinding.rs | 2 +- crates/ui2/src/prelude.rs | 1 + crates/ui2/src/to_extract/breadcrumb.rs | 2 +- crates/ui2/src/to_extract/collab_panel.rs | 2 +- 8 files changed, 15 insertions(+), 11 deletions(-) diff --git a/crates/ui2/src/components/button.rs b/crates/ui2/src/components/button.rs index 437daaa982b21d4e938c3ca823fe2a40432427b3..5787616832e354a501e1f2e10ddf6fec6e480bea 100644 --- a/crates/ui2/src/components/button.rs +++ b/crates/ui2/src/components/button.rs @@ -1,9 +1,11 @@ use std::sync::Arc; -use gpui::{div, rems, DefiniteLength, Hsla, MouseButton, WindowContext}; +use gpui::{div, DefiniteLength, Hsla, MouseButton, WindowContext}; -use crate::{h_stack, Icon, IconColor, IconElement, Label, LabelColor, LineHeightStyle}; -use crate::{prelude::*, IconButton}; +use crate::{ + h_stack, prelude::*, Icon, IconButton, IconColor, IconElement, Label, LabelColor, + LineHeightStyle, +}; /// Provides the flexibility to use either a standard /// button or an icon button in a given context. @@ -167,10 +169,10 @@ impl Button { let icon_color = self.icon_color(); let mut button = h_stack() - .relative() .id(SharedString::from(format!("{}", self.label))) + .relative() .p_1() - .text_size(rems(1.)) + .text_ui() .rounded_md() .bg(self.variant.bg_color(cx)) .hover(|style| style.bg(self.variant.bg_color_hover(cx))) @@ -217,7 +219,7 @@ impl ButtonGroup { } fn render(self, _view: &mut V, cx: &mut ViewContext) -> impl Component { - let mut el = h_stack().text_size(rems(1.)); + let mut el = h_stack().text_ui(); for button in self.buttons { el = el.child(button.render(_view, cx)); diff --git a/crates/ui2/src/components/details.rs b/crates/ui2/src/components/details.rs index c7f6cc1839df780cef995a1e98b9b3f68aa3ca57..f138290f17fd3b6fc325f0972f62f6aa6f996ed1 100644 --- a/crates/ui2/src/components/details.rs +++ b/crates/ui2/src/components/details.rs @@ -31,7 +31,7 @@ impl Details { v_stack() .p_1() .gap_0p5() - .text_xs() + .text_ui_sm() .text_color(cx.theme().colors().text) .size_full() .child(self.text) diff --git a/crates/ui2/src/components/icon_button.rs b/crates/ui2/src/components/icon_button.rs index cb4fb4d7f00463b6a8b4dd0d661fb77d82c62419..f0dc85b445c326f801d5579d5f4002690e617b75 100644 --- a/crates/ui2/src/components/icon_button.rs +++ b/crates/ui2/src/components/icon_button.rs @@ -88,6 +88,7 @@ impl IconButton { .id(self.id.clone()) .justify_center() .rounded_md() + // todo!("Where do these numbers come from?") .py(rems(0.21875)) .px(rems(0.375)) .bg(bg_color) diff --git a/crates/ui2/src/components/input.rs b/crates/ui2/src/components/input.rs index e9f520346c5bb2d036d3f754f13c9452406266c5..1a44827fe8d308f2f73dd3609bf9a4a5ab7625cb 100644 --- a/crates/ui2/src/components/input.rs +++ b/crates/ui2/src/components/input.rs @@ -94,7 +94,7 @@ impl Input { .active(|style| style.bg(input_active_bg)) .flex() .items_center() - .child(div().flex().items_center().text_sm().map(|this| { + .child(div().flex().items_center().text_ui_sm().map(|this| { if self.value.is_empty() { this.child(placeholder_label) } else { diff --git a/crates/ui2/src/components/keybinding.rs b/crates/ui2/src/components/keybinding.rs index 22bbc747a2e5d503d46aff06b9ba1d03d8de5e0b..bd02e694edd45561373f39e2673d7e290dcf30cb 100644 --- a/crates/ui2/src/components/keybinding.rs +++ b/crates/ui2/src/components/keybinding.rs @@ -64,7 +64,7 @@ impl Key { .px_2() .py_0() .rounded_md() - .text_sm() + .text_ui_sm() .text_color(cx.theme().colors().text) .bg(cx.theme().colors().element_background) .child(self.key.clone()) diff --git a/crates/ui2/src/prelude.rs b/crates/ui2/src/prelude.rs index 0f0a22268e5ab271299c575d4a37b4e2f495ff87..545f437a9b4de2ee1deb14eada747e4315112557 100644 --- a/crates/ui2/src/prelude.rs +++ b/crates/ui2/src/prelude.rs @@ -7,6 +7,7 @@ pub use gpui::{ pub use crate::elevation::*; pub use crate::ButtonVariant; +pub use crate::StyledExt; pub use theme2::ActiveTheme; use gpui::Hsla; diff --git a/crates/ui2/src/to_extract/breadcrumb.rs b/crates/ui2/src/to_extract/breadcrumb.rs index cd7df87646a026f352d580ef47e1c1ef90fdb441..782f772fa1472fe6dd213da2d3e7346a03b84395 100644 --- a/crates/ui2/src/to_extract/breadcrumb.rs +++ b/crates/ui2/src/to_extract/breadcrumb.rs @@ -30,7 +30,7 @@ impl Breadcrumb { h_stack() .id("breadcrumb") .px_1() - .text_sm() + .text_ui_sm() .text_color(cx.theme().colors().text_muted) .rounded_md() .hover(|style| style.bg(cx.theme().colors().ghost_element_hover)) diff --git a/crates/ui2/src/to_extract/collab_panel.rs b/crates/ui2/src/to_extract/collab_panel.rs index 7b785ae9e1dbbda8c5392baa1473a7a31d6ce1eb..d56166ad2e25303f1d0d8e01d50fe4e233437cf8 100644 --- a/crates/ui2/src/to_extract/collab_panel.rs +++ b/crates/ui2/src/to_extract/collab_panel.rs @@ -77,7 +77,7 @@ impl CollabPanel { .items_center() .child( div() - .text_sm() + .text_ui_sm() .text_color(cx.theme().colors().text_placeholder) .child("Find..."), ),