zino_dioxus/form/
progress.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
use crate::class::Class;
use dioxus::prelude::*;
use zino_core::SharedString;

/// Native HTML progress bars.
pub fn Progress(props: ProgressProps) -> Element {
    rsx! {
        progress {
            class: "{props.class}",
            class: if !props.color.is_empty() { "is-{props.color}" },
            class: if !props.size.is_empty() { "is-{props.size}" },
            ..props.attributes,
            { props.children }
        }
    }
}

/// The [`Progress`] properties struct for the configuration of the component.
#[derive(Clone, PartialEq, Props)]
pub struct ProgressProps {
    /// The class attribute for the component.
    #[props(into, default = "progress")]
    pub class: Class,
    /// The color of the button: `primary` | `link` | `info` | `success` | `warning` | `danger`.
    #[props(into, default)]
    pub color: SharedString,
    /// The size of the button: `small` | `normal` | `medium` | `large`.
    #[props(into, default)]
    pub size: SharedString,
    /// Spreading the props of the `input` element.
    #[props(extends = input)]
    attributes: Vec<Attribute>,
    /// The children to render within the component.
    children: Element,
}