Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
bevyengine
GitHub Repository: bevyengine/bevy
Path: blob/main/crates/bevy_feathers/src/containers/group.rs
30636 views
1
use bevy_scene::{bsn, Scene};
2
use bevy_text::FontWeight;
3
use bevy_ui::{px, AlignItems, Display, FlexDirection, JustifyContent, Node, UiRect};
4
5
use crate::{
6
constants::{fonts, size},
7
font_styles::InheritableFont,
8
rounded_corners::RoundedCorners,
9
theme::{InheritableThemeTextColor, ThemeBackgroundColor, ThemeBorderColor},
10
tokens,
11
};
12
13
/// Group
14
pub fn group() -> impl Scene {
15
bsn! {
16
Node {
17
display: Display::Flex,
18
flex_direction: FlexDirection::Column,
19
align_items: AlignItems::Stretch,
20
}
21
}
22
}
23
24
/// Group header
25
pub fn group_header() -> impl Scene {
26
bsn! {
27
Node {
28
display: Display::Flex,
29
flex_direction: FlexDirection::Row,
30
align_items: AlignItems::Center,
31
justify_content: JustifyContent::SpaceBetween,
32
border: UiRect {
33
left: px(1),
34
top: px(1),
35
right: px(1),
36
},
37
padding: UiRect::horizontal(px(10)),
38
min_height: size::HEADER_HEIGHT,
39
column_gap: px(4),
40
border_radius: {RoundedCorners::Top.to_border_radius(4.0)}
41
}
42
ThemeBackgroundColor(tokens::GROUP_HEADER_BG)
43
ThemeBorderColor(tokens::GROUP_HEADER_BORDER)
44
InheritableThemeTextColor(tokens::GROUP_HEADER_TEXT)
45
InheritableFont {
46
font: fonts::REGULAR,
47
font_size: size::MEDIUM_FONT,
48
weight: FontWeight::NORMAL,
49
}
50
}
51
}
52
53
/// Group body
54
pub fn group_body() -> impl Scene {
55
bsn! {
56
Node {
57
display: Display::Flex,
58
flex_direction: FlexDirection::Column,
59
border: UiRect {
60
left: px(1),
61
right: px(1),
62
bottom: px(1),
63
},
64
row_gap: px(4),
65
padding: px(6),
66
border_radius: {RoundedCorners::Bottom.to_border_radius(4.0)}
67
}
68
ThemeBackgroundColor(tokens::GROUP_BODY_BG)
69
ThemeBorderColor(tokens::GROUP_BODY_BORDER)
70
InheritableFont {
71
font: fonts::REGULAR,
72
font_size: size::MEDIUM_FONT,
73
weight: FontWeight::NORMAL,
74
}
75
}
76
}
77
78