bevy_codex/widgets/panel/
components.rs1use bevy::{color::palettes::css::WHITE, prelude::*, sprite::Anchor};
2
3use crate::widgets::{button::components::CustomButtonRef, status_bar::components::StatusBar};
4
5#[derive(Component, Clone)]
6pub struct PanelUi;
7
8#[derive(Component)]
9pub struct PanelText;
10
11#[derive(Component)]
12pub struct Panel<T> {
13 pub text: Option<String>,
14 pub texture: Option<Handle<Image>>,
15 pub color: Color,
16 pub text_alignment: Anchor,
17 pub content: Vec<T>,
18}
19
20impl Default for Panel<CustomButtonRef> {
21 fn default() -> Self {
22 Self {
23 text: None,
24 texture: None,
25 color: WHITE.into(),
26 text_alignment: Anchor::TopCenter,
27 content: vec![],
28 }
29 }
30}
31
32
33impl Default for Panel<StatusBar> {
34 fn default() -> Self {
35 Self {
36 text: None,
37 texture: None,
38 color: WHITE.into(),
39 text_alignment: Anchor::CenterLeft,
40 content: vec![],
41 }
42 }
43}