1use strum_macros::{Display, EnumString};
2
3#[derive(PartialEq, Clone)]
4pub enum ButtonType {
5 Close,
6 Minimize,
7 Maximize,
8}
9
10impl ButtonType {
11 pub fn as_class(&self) -> &'static str {
12 match self {
13 ButtonType::Close => "bg-red-500 hover:bg-red-600 focus:ring-red-300",
14 ButtonType::Minimize => "bg-yellow-500 hover:bg-yellow-600 focus:ring-yellow-300",
15 ButtonType::Maximize => "bg-green-500 hover:bg-green-600 focus:ring-green-300",
16 }
17 }
18
19 pub fn default_aria_label(&self) -> &'static str {
20 match self {
21 ButtonType::Close => "Close window",
22 ButtonType::Minimize => "Minimize window",
23 ButtonType::Maximize => "Maximize window",
24 }
25 }
26
27 pub fn default_title(&self) -> &'static str {
28 match self {
29 ButtonType::Close => "Close window (Cmd+W)",
30 ButtonType::Minimize => "Minimize window (Cmd+M)",
31 ButtonType::Maximize => "Maximize window (Cmd+Ctrl+F)",
32 }
33 }
34}
35
36#[derive(PartialEq, Clone, Default, Debug, EnumString, Display)]
37#[strum(serialize_all = "snake_case")]
38pub enum Size {
39 Small,
40 #[default]
41 Medium,
42 Large,
43 Full,
44}
45
46impl Size {
47 pub fn to_style(&self) -> &'static str {
48 match self {
49 Size::Small => "max-width: 28rem; width: auto;",
50 Size::Medium => "max-width: 42rem; width: auto;",
51 Size::Large => "max-width: 56rem; width: auto;",
52 Size::Full => "width: 100%;",
53 }
54 }
55}
56
57#[derive(PartialEq, Clone, Default, Debug, EnumString, Display)]
58#[strum(serialize_all = "snake_case")]
59pub enum Variant {
60 #[default]
61 Default,
62 Tabs,
63 Ios,
64}