use waterui_core::View;
use waterui_core::layout::StretchAxis;
use waterui_graphics::color::{BorderColor, Color};
use crate::{frame::Frame, stack};
#[derive(Debug, Clone, Copy)]
#[must_use]
pub struct Divider;
impl View for Divider {
fn body(self, env: &waterui_core::Environment) -> impl View {
let vertical_divider = matches!(env.get::<stack::Axis>(), Some(stack::Axis::Horizontal));
if vertical_divider {
Frame::new(Color::new(BorderColor)).width(1.0)
} else {
Frame::new(Color::new(BorderColor)).height(1.0)
}
}
fn stretch_axis(&self) -> StretchAxis {
StretchAxis::CrossAxis
}
}