Update usages of `text_size_*` to `text_ui` in ui components

Nate Butler and Marshall Bowers created

Co-Authored-By: Marshall Bowers <1486634+maxdeviant@users.noreply.github.com>

Change summary

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(-)

Detailed changes

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<V: 'static> Button<V> {
         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<V: 'static> ButtonGroup<V> {
     }
 
     fn render(self, _view: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {
-        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));

crates/ui2/src/components/details.rs 🔗

@@ -31,7 +31,7 @@ impl<V: 'static> Details<V> {
         v_stack()
             .p_1()
             .gap_0p5()
-            .text_xs()
+            .text_ui_sm()
             .text_color(cx.theme().colors().text)
             .size_full()
             .child(self.text)

crates/ui2/src/components/icon_button.rs 🔗

@@ -88,6 +88,7 @@ impl<V: 'static> IconButton<V> {
             .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)

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 {

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())

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;

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))