Fix Label text_align again.
This commit is contained in:
parent
ed132ad55e
commit
4c81977639
2 changed files with 3 additions and 3 deletions
|
|
@ -52,9 +52,8 @@ impl Render for CheckboxStory {
|
||||||
.child(
|
.child(
|
||||||
section("Label", cx)
|
section("Label", cx)
|
||||||
.child(
|
.child(
|
||||||
h_flex()
|
v_flex()
|
||||||
.w_full()
|
.w_full()
|
||||||
.justify_between()
|
|
||||||
.gap_4()
|
.gap_4()
|
||||||
.child(Label::new("Text align left"))
|
.child(Label::new("Text align left"))
|
||||||
.child(Label::new("Text align center").text_center())
|
.child(Label::new("Text align center").text_center())
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ use gpui::{
|
||||||
Styled, WindowContext,
|
Styled, WindowContext,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::theme::ActiveTheme;
|
use crate::{theme::ActiveTheme, StyledExt};
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub enum TextAlign {
|
pub enum TextAlign {
|
||||||
|
|
@ -88,6 +88,7 @@ impl RenderOnce for Label {
|
||||||
|
|
||||||
div().text_color(cx.theme().foreground).child(
|
div().text_color(cx.theme().foreground).child(
|
||||||
self.base
|
self.base
|
||||||
|
.h_flex()
|
||||||
.map(|this| match self.align {
|
.map(|this| match self.align {
|
||||||
TextAlign::Left => this.justify_start(),
|
TextAlign::Left => this.justify_start(),
|
||||||
TextAlign::Center => this.justify_center(),
|
TextAlign::Center => this.justify_center(),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue