zino_dioxus/typography/
card.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
use crate::class::Class;
use dioxus::prelude::*;

/// A fixed-width span with the custom alignment.
pub fn Card(props: CardProps) -> Element {
    rsx! {
        div {
            class: props.class,
            header {
                class: "card-header",
                div {
                    class: "card-header-title",
                    { props.title }
                }
            }
            section {
                class: "card-content",
                div {
                    class: "content",
                    { props.content }
                }
            }
            if props.footer.is_some() {
                footer {
                    class: "card-footer",
                    { props.footer }
                }
            }
        }
    }
}

/// The [`Card`] properties struct for the configuration of the component.
#[derive(Clone, PartialEq, Props)]
pub struct CardProps {
    /// The class attribute for the component.
    #[props(into, default = "card")]
    pub class: Class,
    /// The modal title to render within the component.
    pub title: Element,
    /// The modal content to render within the component.
    pub content: Element,
    /// The modal footer to render within the component.
    pub footer: Option<VNode>,
}