1use crate::css::{Color, Length, Radius, Spacing};
4
5pub mod flex {
7 use crate::css::{AlignItems, FlexDirection, JustifyContent};
8
9 pub fn container(
11 direction: FlexDirection,
12 justify: JustifyContent,
13 align: AlignItems,
14 ) -> String {
15 format!(
16 "display: flex; flex-direction: {}; justify-content: {}; align-items: {};",
17 direction.to_css(),
18 justify.to_css(),
19 align.to_css()
20 )
21 }
22
23 pub fn center() -> String {
25 container(
26 FlexDirection::Row,
27 JustifyContent::Center,
28 AlignItems::Center,
29 )
30 }
31
32 pub fn space_between() -> String {
34 container(
35 FlexDirection::Row,
36 JustifyContent::SpaceBetween,
37 AlignItems::Center,
38 )
39 }
40}
41
42pub mod spacing {
44 use super::*;
45
46 pub fn uniform(value: Length) -> Spacing {
48 Spacing::all(value)
49 }
50
51 pub fn horizontal(value: Length) -> Spacing {
53 Spacing::vh(Length::Zero, value)
54 }
55
56 pub fn vertical(value: Length) -> Spacing {
58 Spacing::vh(value, Length::Zero)
59 }
60}
61
62pub mod radius {
64 use super::*;
65
66 pub fn small() -> Radius {
68 Radius::all(Length::px(4.0))
69 }
70
71 pub fn medium() -> Radius {
73 Radius::all(Length::px(8.0))
74 }
75
76 pub fn large() -> Radius {
78 Radius::all(Length::px(16.0))
79 }
80
81 pub fn full() -> Radius {
83 Radius::all(Length::percent(50.0))
84 }
85}
86
87pub mod colors {
89 use super::*;
90
91 pub mod palette {
93 use super::*;
94
95 pub fn blue() -> Color {
96 Color::hex("#007bff")
97 }
98
99 pub fn red() -> Color {
100 Color::hex("#dc3545")
101 }
102
103 pub fn green() -> Color {
104 Color::hex("#28a745")
105 }
106
107 pub fn yellow() -> Color {
108 Color::hex("#ffc107")
109 }
110
111 pub fn gray() -> Color {
112 Color::hex("#6c757d")
113 }
114 }
115}