marc2332 / freya

Cross-platform GUI library for 🦀 Rust powered by 🧬 Dioxus and 🎨 Skia.
https://freyaui.dev/
MIT License
1.33k stars 51 forks source link

enhancement: `Divider` component #792

Open marc2332 opened 1 month ago

reyamir commented 1 month ago

this is my divider component

#[derive(Clone, PartialEq)]
pub enum Direction {
    VERTICAL,
    HORIZONTAL,
}

#[component]
pub fn Divider(background: String, direction: Direction) -> Element {
    match direction {
        Direction::VERTICAL => rsx!(
            rect {
                width: "1",
                height: "100%",
                background: background,
            }
        ),
        Direction::HORIZONTAL => rsx!(
            rect {
                width: "100%",
                height: "1",
                background: background,
            }
        )
    }
}