Fix Label text_align again.

This commit is contained in:
Jason Lee 2024-07-24 19:01:43 +08:00
parent ed132ad55e
commit 4c81977639
2 changed files with 3 additions and 3 deletions

View file

@ -52,9 +52,8 @@ impl Render for CheckboxStory {
.child(
section("Label", cx)
.child(
h_flex()
v_flex()
.w_full()
.justify_between()
.gap_4()
.child(Label::new("Text align left"))
.child(Label::new("Text align center").text_center())

View file

@ -3,7 +3,7 @@ use gpui::{
Styled, WindowContext,
};
use crate::theme::ActiveTheme;
use crate::{theme::ActiveTheme, StyledExt};
#[derive(Default)]
pub enum TextAlign {
@ -88,6 +88,7 @@ impl RenderOnce for Label {
div().text_color(cx.theme().foreground).child(
self.base
.h_flex()
.map(|this| match self.align {
TextAlign::Left => this.justify_start(),
TextAlign::Center => this.justify_center(),