use super::*;
#[component]
pub fn euv_separator(node: VirtualNode<EuvSeparatorProps>) -> VirtualNode {
let EuvSeparatorProps {
orientation,
decorative,
}: EuvSeparatorProps = node.try_get_props().unwrap_or_default();
let orientation_class: &Css = match orientation {
EuvSeparatorOrientation::Horizontal => c_euv_separator_horizontal(),
EuvSeparatorOrientation::Vertical => c_euv_separator_vertical(),
};
let orientation_attr: &str = match orientation {
EuvSeparatorOrientation::Horizontal => SEPARATOR_ORIENTATION_HORIZONTAL,
EuvSeparatorOrientation::Vertical => SEPARATOR_ORIENTATION_VERTICAL,
};
let role: &str = if decorative {
SEPARATOR_ROLE_DECORATIVE
} else {
SEPARATOR_ROLE_SEPARATOR
};
let children: VirtualNode = node.get_children().into();
let base_class: &Css = c_euv_separator();
html! {
div {
"data-slot": "separator"
role: role
"aria-orientation": orientation_attr
"data-orientation": orientation_attr
class: base_class
class: orientation_class
children
}
}
}