impulse_thaw/drawer/
mod.rs1mod drawer_body;
2mod drawer_header;
3mod drawer_header_title;
4mod inline_drawer;
5mod overlay_drawer;
6
7pub use drawer_body::*;
8pub use drawer_header::*;
9pub use drawer_header_title::*;
10pub use inline_drawer::*;
11pub use overlay_drawer::*;
12
13use leptos::prelude::{Get, Signal};
14
15#[derive(Clone, Default, Copy)]
16pub enum DrawerPosition {
17 Top,
18 Bottom,
19 #[default]
20 Left,
21 Right,
22}
23
24impl DrawerPosition {
25 pub fn as_str(&self) -> &'static str {
26 match self {
27 Self::Top => "top",
28 Self::Bottom => "bottom",
29 Self::Left => "left",
30 Self::Right => "right",
31 }
32 }
33}
34
35#[derive(Clone, Default, Copy)]
36pub enum DrawerSize {
37 #[default]
38 FitNav,
39 Small,
40 Medium,
41 Large,
42 Full,
43}
44
45impl DrawerSize {
46 fn as_size_str(&self, position: Signal<DrawerPosition>) -> &'static str {
47 match self {
48 Self::FitNav => "260px",
49 Self::Small => "320px",
50 Self::Medium => "592px",
51 Self::Large => "940px",
52 Self::Full => match position.get() {
53 DrawerPosition::Top | DrawerPosition::Bottom => "100vh",
54 DrawerPosition::Left | DrawerPosition::Right => "100vw",
55 },
56 }
57 }
58}
59
60#[derive(Debug, Default, PartialEq)]
61pub enum DrawerModalType {
62 #[default]
65 Modal,
66 NonModal,
69}