Skip to content

Commit

Permalink
fix: update styling for Container
Browse files Browse the repository at this point in the history
  • Loading branch information
matthunz committed Dec 6, 2024
1 parent 5f96e02 commit 9cca3a7
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/material/container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@ use super::{MaterialTheme, Modifier, Modify};
use crate::{ecs::spawn, prelude::Compose, use_context, Data, Scope, Signal};
use bevy_color::Color;
use bevy_ui::{
AlignItems, BackgroundColor, BorderRadius, BoxShadow, JustifyContent, Node, Overflow, UiRect,
Val,
AlignItems, BackgroundColor, BorderRadius, BoxShadow, FlexDirection, JustifyContent, Node,
Overflow, UiRect, Val,
};

/// Create a material UI button.
pub fn container<'a, C>(content: C) -> Container<'a, C> {
Container {
content,
elevation: 0.,
height: Val::Px(40.),
padding: UiRect::left(Val::Px(24.)).with_right(Val::Px(24.)),
background_color: None,
border_radius: BorderRadius::all(Val::Px(12.)),
Expand All @@ -23,7 +22,6 @@ pub fn container<'a, C>(content: C) -> Container<'a, C> {
pub struct Container<'a, C> {
content: C,
padding: UiRect,
height: Val,
elevation: f32,
modifier: Modifier<'a>,
background_color: Option<Color>,
Expand Down Expand Up @@ -68,10 +66,10 @@ impl<C: Compose> Compose for Container<'_, C> {
.modifier
.apply(spawn((
Node {
flex_direction: FlexDirection::Column,
justify_content: JustifyContent::Center,
align_items: AlignItems::Center,
padding: cx.me().padding,
height: cx.me().height,
overflow: Overflow::clip(),
..Default::default()
},
Expand Down

0 comments on commit 9cca3a7

Please sign in to comment.