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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
use makara::prelude::*;
use bevy::prelude::*;
fn main() {
App::new()
.add_plugins(MakaraPlugin::default())
.add_systems(Startup, setup)
.run();
}
fn setup(mut commands: Commands) {
commands.spawn(
root_!(
background_color: Color::srgb(0.9, 0.9, 0.9),
class: "justify-center align-center p-4";
[
// Main container
column_!(
class: "justify-start align-stretch",
width: percent(90),
height: percent(90),
background_color: Color::WHITE;
[
// Header
row_!(
class: "justify-center align-center p-3 mb-4",
background_color: Color::srgb(0.2, 0.3, 0.8);
[
text_!(
"Container Alignment Classes Demo",
font_size: 24.0,
color: Color::WHITE
)
]
),
// Info text
row_!(
class: "justify-center align-center mb-4";
[
text_!(
"Alignment classes work on: root, row, column, scroll containers",
font_size: 16.0,
color: Color::srgb(0.5, 0.5, 0.5)
)
]
),
// Justify Content Examples
column_!(
class: "mb-4";
[
text_!("Justify Content Examples:", font_size: 18.0, class: "mb-2"),
// justify-start
row_!(
class: "justify-start align-center p-2 mb-2",
background_color: Color::srgb(0.95, 0.95, 1.0);
[
text_!("Start", color: Color::srgb(0.8, 0.2, 0.2)),
text_!("Middle", color: Color::srgb(0.2, 0.6, 0.2)),
text_!("End", color: Color::srgb(0.2, 0.2, 0.8))
]
),
// justify-center
row_!(
class: "justify-center align-center p-2 mb-2",
background_color: Color::srgb(0.95, 1.0, 0.95);
[
text_!("Start", color: Color::srgb(0.8, 0.2, 0.2)),
text_!("Middle", color: Color::srgb(0.2, 0.6, 0.2)),
text_!("End", color: Color::srgb(0.2, 0.2, 0.8))
]
),
// justify-end
row_!(
class: "justify-end align-center p-2 mb-2",
background_color: Color::srgb(1.0, 0.95, 0.95);
[
text_!("Start", color: Color::srgb(0.8, 0.2, 0.2)),
text_!("Middle", color: Color::srgb(0.2, 0.6, 0.2)),
text_!("End", color: Color::srgb(0.2, 0.2, 0.8))
]
),
// justify-between
row_!(
class: "justify-between align-center p-2 mb-2",
background_color: Color::srgb(1.0, 1.0, 0.95);
[
text_!("Start", color: Color::srgb(0.8, 0.2, 0.2)),
text_!("Middle", color: Color::srgb(0.2, 0.6, 0.2)),
text_!("End", color: Color::srgb(0.2, 0.2, 0.8))
]
)
]
),
// Align Items Examples
column_!(
class: "mb-4";
[
text_!("Align Items Examples:", font_size: 18.0, class: "mb-2"),
row_!(
class: "justify-around";
[
// align-start
column_!(
class: "align-start justify-center p-2 mr-2",
width: px(120),
height: px(100),
background_color: Color::srgb(0.95, 0.95, 1.0);
[
text_!("align-start", font_size: 12.0),
text_!("Content", font_size: 10.0, color: Color::srgb(0.6, 0.6, 0.6))
]
),
// align-center
column_!(
class: "align-center justify-center p-2 mr-2",
width: px(120),
height: px(100),
background_color: Color::srgb(0.95, 1.0, 0.95);
[
text_!("align-center", font_size: 12.0),
text_!("Content", font_size: 10.0, color: Color::srgb(0.6, 0.6, 0.6))
]
),
// align-end
column_!(
class: "align-end justify-center p-2",
width: px(120),
height: px(100),
background_color: Color::srgb(1.0, 0.95, 0.95);
[
text_!("align-end", font_size: 12.0),
text_!("Content", font_size: 10.0, color: Color::srgb(0.6, 0.6, 0.6))
]
)
]
)
]
),
// Combined Examples
column_!(
[
text_!("Combined Alignment Examples:", font_size: 18.0, class: "mb-2"),
row_!(
class: "justify-between";
[
// Top-left
column_!(
class: "justify-start align-start p-3",
width: px(150),
height: px(80),
background_color: Color::srgb(0.9, 0.9, 1.0);
[
text_!("Top-Left", font_size: 14.0),
text_!("🔝⬅️", font_size: 12.0)
]
),
// Center-center
column_!(
class: "justify-center align-center p-3",
width: px(150),
height: px(80),
background_color: Color::srgb(0.9, 1.0, 0.9);
[
text_!("Center", font_size: 14.0),
text_!("🎯", font_size: 12.0)
]
),
// Bottom-right
column_!(
class: "justify-end align-end p-3",
width: px(150),
height: px(80),
background_color: Color::srgb(1.0, 0.9, 0.9);
[
text_!("Bottom-Right", font_size: 14.0),
text_!("🔽➡️", font_size: 12.0)
]
),
// Scroll container example
text_!("Scroll Container Example:", font_size: 18.0, class: "mb-2 mt-4"),
scroll_!(
width: percent(100),
height: px(120),
background_color: Color::srgb(0.95, 0.95, 0.95),
class: "justify-center align-center p-3";
[
column_!(
class: "justify-start align-center";
[
text_!("Scrollable content with alignment", font_size: 14.0),
text_!("Line 2 - scroll to see more", font_size: 12.0, color: Color::srgb(0.6, 0.6, 0.6)),
text_!("Line 3 - centered alignment", font_size: 12.0, color: Color::srgb(0.6, 0.6, 0.6)),
text_!("Line 4 - in scroll container", font_size: 12.0, color: Color::srgb(0.6, 0.6, 0.6)),
text_!("Line 5 - more content below", font_size: 12.0, color: Color::srgb(0.6, 0.6, 0.6)),
text_!("Line 6 - keep scrolling", font_size: 12.0, color: Color::srgb(0.6, 0.6, 0.6))
]
)
]
)
]
)
]
)
]
)
]
)
);
}