use dioxus::prelude::*;
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
#[non_exhaustive]
pub enum ChartMotionDuration {
Fast,
#[default]
Standard,
Slow,
}
impl ChartMotionDuration {
pub fn as_str(self) -> &'static str {
match self {
Self::Fast => "fast",
Self::Standard => "standard",
Self::Slow => "slow",
}
}
}
#[derive(Props, Clone, PartialEq)]
pub struct ChartMotionProps {
#[props(default)]
pub duration: ChartMotionDuration,
#[props(into)]
pub class: Option<String>,
#[props(extends = GlobalAttributes, extends = div)]
pub attributes: Vec<Attribute>,
pub children: Element,
}
#[component]
pub fn ChartMotion(props: ChartMotionProps) -> Element {
rsx! {
div {
class: props.class,
"data-ui-chart-motion": "true",
..props.attributes,
{props.children}
}
}
}