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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
use bevy::{color::palettes::css::WHITE, prelude::*, sprite::Anchor};

use crate::widgets::{button::components::CustomButtonRef, status_bar::components::StatusBar};

#[derive(Component, Clone)]
pub struct PanelUi;

#[derive(Component)]
pub struct PanelText;

#[derive(Component)]
pub struct Panel<T> {
    pub text: Option<String>,
    pub texture: Option<Handle<Image>>,
    pub color: Color,
    pub text_alignment: Anchor,
    pub content: Vec<T>,
}

impl Default for Panel<CustomButtonRef> {
    fn default() -> Self {
        Self {
            text: None,
            texture: None,
            color: WHITE.into(),
            text_alignment: Anchor::TopCenter,
            content: vec![],
        }
    }
}


impl Default for Panel<StatusBar> {
    fn default() -> Self {
        Self {
            text: None,
            texture: None,
            color: WHITE.into(),
            text_alignment: Anchor::CenterLeft,
            content: vec![],
        }
    }
}