zino_dioxus/layout/
container.rs

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
use crate::class::Class;
use dioxus::prelude::*;

/// A responsive, fixed-width container with the `max-width` changes at each breakpoint.
pub fn Container(props: ContainerProps) -> Element {
    rsx! {
        main {
            class: props.class,
            { props.children }
        }
    }
}

/// The [`FluidContainer`] properties struct for the configuration of the component.
#[derive(Clone, PartialEq, Props)]
pub struct ContainerProps {
    /// The class attribute for the component.
    #[props(into, default = "container")]
    pub class: Class,
    /// The children to render within the component.
    children: Element,
}

/// A full width container spanning the entire width of the viewport.
pub fn FluidContainer(props: FluidContainerProps) -> Element {
    rsx! {
        main {
            class: props.class,
            width: "100%",
            { props.children }
        }
    }
}

/// The [`FluidContainer`] properties struct for the configuration of the component.
#[derive(Clone, PartialEq, Props)]
pub struct FluidContainerProps {
    /// The class attribute for the component.
    #[props(into, default = "container is-fluid")]
    pub class: Class,
    /// The children to render within the component.
    children: Element,
}

/// A container rendered as the `<main>` element.
pub fn MainContainer(props: MainContainerProps) -> Element {
    rsx! {
        main {
            class: props.class,
            { props.children }
        }
    }
}

/// The [`MainContainer`] properties struct for the configuration of the component.
#[derive(Clone, PartialEq, Props)]
pub struct MainContainerProps {
    /// The class attribute for the component.
    #[props(into, default = "main-container px-3 py-3")]
    pub class: Class,
    /// The children to render within the component.
    children: Element,
}