ui_storybook/components/primitives/
divider.rs1use leptos::prelude::*;
7
8#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
10pub enum DividerOrientation {
11 #[default]
13 Horizontal,
14 Vertical,
17}
18
19impl DividerOrientation {
20 #[must_use]
22 pub fn css(self) -> &'static str {
23 match self {
24 DividerOrientation::Horizontal => "divider-h",
25 DividerOrientation::Vertical => "divider-v",
26 }
27 }
28}
29
30#[component]
31pub fn Divider(
32 #[prop(optional)] orientation: DividerOrientation,
33 #[prop(optional, into)] extra_class: String,
34) -> impl IntoView {
35 let class = format!(
36 "divider {}{}{}",
37 orientation.css(),
38 if extra_class.is_empty() { "" } else { " " },
39 extra_class,
40 );
41 view! { <div class=class role="separator"></div> }
42}