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

View file

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

View file

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

View file

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