1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
use bevy::prelude::*;

#[derive(Bundle)]
pub struct CardWidget {
    pub base: NodeBundle,
}

impl CardWidget {
    pub fn new(width: f32, height: f32, background_color: BackgroundColor) -> Self {
        Self {
            base: NodeBundle {
                style: Style {
                    width: Val::Percent(width),
                    height: Val::Percent(height),
                    justify_content: JustifyContent::Center,

                    ..default()
                },

                background_color,
                ..default()
            },
        }
    }
}