From 5d3f19bdd843bae3b7fafcef0e15dfc8760b72a4 Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Fri, 28 Jun 2024 00:18:15 +0800 Subject: [PATCH] Fix Label text_size support. --- crates/ui-story/src/dropdown_story.rs | 10 ++-------- crates/ui-story/src/lib.rs | 6 ++++-- crates/ui/src/dropdown.rs | 4 +--- crates/ui/src/label.rs | 5 +---- 4 files changed, 8 insertions(+), 17 deletions(-) diff --git a/crates/ui-story/src/dropdown_story.rs b/crates/ui-story/src/dropdown_story.rs index c206a1c0..89e588e8 100644 --- a/crates/ui-story/src/dropdown_story.rs +++ b/crates/ui-story/src/dropdown_story.rs @@ -1,16 +1,12 @@ -use std::{rc::Rc, vec}; - use gpui::{ - div, px, ClickEvent, IntoElement, ParentElement, Render, RenderOnce, SharedString, Styled, - View, ViewContext, VisualContext, WindowContext, + px, IntoElement, ParentElement, Render, Styled, View, ViewContext, VisualContext, WindowContext, }; use ui::{ - checkbox::Checkbox, dropdown::{Dropdown, DropdownDelegate, DropdownItem}, h_flex, theme::ActiveTheme, - v_flex, Disableable as _, Selection, + v_flex, Selection, }; use super::story_case; @@ -127,8 +123,6 @@ impl Render for DropdownStory { .child( v_flex() .size_full() - .items_start() - .justify_start() .gap_4() .child( h_flex() diff --git a/crates/ui-story/src/lib.rs b/crates/ui-story/src/lib.rs index b01e1aa4..3fb2da30 100644 --- a/crates/ui-story/src/lib.rs +++ b/crates/ui-story/src/lib.rs @@ -15,6 +15,7 @@ mod picker_story; mod switch_story; use ui::{ + divider::Divider, label::Label, tab::{Tab, TabBar}, Selectable, @@ -58,15 +59,16 @@ impl RenderOnce for StoryContainer { div() .flex() .flex_col() - .gap_4() + .gap_6() .child( div() .flex() .flex_col() - .gap_2() + .gap_4() .child(Label::new(self.name).text_size(px(24.0))) .child(Label::new(self.description).text_size(px(16.0))), ) + .child(Divider::horizontal()) .children(self.children) } } diff --git a/crates/ui/src/dropdown.rs b/crates/ui/src/dropdown.rs index 6bc6b1ef..f712c42d 100644 --- a/crates/ui/src/dropdown.rs +++ b/crates/ui/src/dropdown.rs @@ -244,9 +244,7 @@ where this.child( div() .absolute() - // Top is the dropdown input height + border - .top(px(50.)) - .left_0() + .mt_1p5() .bg(cx.theme().background) .border_1() .border_color(cx.theme().input) diff --git a/crates/ui/src/label.rs b/crates/ui/src/label.rs index c7e6aa4e..07a5e3c1 100644 --- a/crates/ui/src/label.rs +++ b/crates/ui/src/label.rs @@ -41,9 +41,6 @@ impl RenderOnce for Label { self.label }; - self.base - .text_color(cx.theme().foreground) - .text_size(px(cx.theme().font_size)) - .child(text) + self.base.text_color(cx.theme().foreground).child(text) } }