Skip to content

Commit

Permalink
Refactor label
Browse files Browse the repository at this point in the history
  • Loading branch information
janhohenheim committed Aug 10, 2024
1 parent cfc390d commit e6600ca
Showing 1 changed file with 9 additions and 18 deletions.
27 changes: 9 additions & 18 deletions src/theme/widgets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,28 +95,19 @@ impl<T: Spawn> Widgets for T {
fn label(&mut self, text: impl Into<String>) -> EntityCommands {
let mut entity = self.spawn((
Name::new("Label"),
NodeBundle {
style: Style {
width: Px(500.0),
align_items: AlignItems::Center,
TextBundle::from_section(
text,
TextStyle {
font_size: 24.0,
color: LABEL_TEXT,
..default()
},
)
.with_style(Style {
width: Px(500.0),
..default()
},
}),
));
entity.with_children(|children| {
children.spawn((
Name::new("Label Text"),
TextBundle::from_section(
text,
TextStyle {
font_size: 24.0,
color: LABEL_TEXT,
..default()
},
),
));
});
entity
}
}
Expand Down

0 comments on commit e6600ca

Please sign in to comment.