Fix Label text_size support.

This commit is contained in:
Jason Lee 2024-06-28 00:18:15 +08:00
parent 63076725f2
commit 5d3f19bdd8
4 changed files with 8 additions and 17 deletions

View file

@ -1,16 +1,12 @@
use std::{rc::Rc, vec};
use gpui::{ use gpui::{
div, px, ClickEvent, IntoElement, ParentElement, Render, RenderOnce, SharedString, Styled, px, IntoElement, ParentElement, Render, Styled, View, ViewContext, VisualContext, WindowContext,
View, ViewContext, VisualContext, WindowContext,
}; };
use ui::{ use ui::{
checkbox::Checkbox,
dropdown::{Dropdown, DropdownDelegate, DropdownItem}, dropdown::{Dropdown, DropdownDelegate, DropdownItem},
h_flex, h_flex,
theme::ActiveTheme, theme::ActiveTheme,
v_flex, Disableable as _, Selection, v_flex, Selection,
}; };
use super::story_case; use super::story_case;
@ -127,8 +123,6 @@ impl Render for DropdownStory {
.child( .child(
v_flex() v_flex()
.size_full() .size_full()
.items_start()
.justify_start()
.gap_4() .gap_4()
.child( .child(
h_flex() h_flex()

View file

@ -15,6 +15,7 @@ mod picker_story;
mod switch_story; mod switch_story;
use ui::{ use ui::{
divider::Divider,
label::Label, label::Label,
tab::{Tab, TabBar}, tab::{Tab, TabBar},
Selectable, Selectable,
@ -58,15 +59,16 @@ impl RenderOnce for StoryContainer {
div() div()
.flex() .flex()
.flex_col() .flex_col()
.gap_4() .gap_6()
.child( .child(
div() div()
.flex() .flex()
.flex_col() .flex_col()
.gap_2() .gap_4()
.child(Label::new(self.name).text_size(px(24.0))) .child(Label::new(self.name).text_size(px(24.0)))
.child(Label::new(self.description).text_size(px(16.0))), .child(Label::new(self.description).text_size(px(16.0))),
) )
.child(Divider::horizontal())
.children(self.children) .children(self.children)
} }
} }

View file

@ -244,9 +244,7 @@ where
this.child( this.child(
div() div()
.absolute() .absolute()
// Top is the dropdown input height + border .mt_1p5()
.top(px(50.))
.left_0()
.bg(cx.theme().background) .bg(cx.theme().background)
.border_1() .border_1()
.border_color(cx.theme().input) .border_color(cx.theme().input)

View file

@ -41,9 +41,6 @@ impl RenderOnce for Label {
self.label self.label
}; };
self.base self.base.text_color(cx.theme().foreground).child(text)
.text_color(cx.theme().foreground)
.text_size(px(cx.theme().font_size))
.child(text)
} }
} }