aura-gui 0.2.2

UI nativa acelerada por GPU para escritorio, Android e iOS, en un solo crate: estilo tipo Tailwind, componentes, sombras, animaciones y agentes de IA. Reposo a cero. Licencia AGPL-3.0 o comercial.
//! Barra de estado inferior con grupos a izquierda y derecha.

use crate::core::px;
use crate::view::prelude::*;
use crate::widgets::separator::horizontal_separator;

pub struct StatusBar {
    left: Vec<AnyElement>,
    right: Vec<AnyElement>,
}

impl StatusBar {
    pub fn new() -> Self {
        Self { left: Vec::new(), right: Vec::new() }
    }

    pub fn left(mut self, item: impl IntoElement) -> Self {
        self.left.push(item.into_element());
        self
    }

    pub fn right(mut self, item: impl IntoElement) -> Self {
        self.right.push(item.into_element());
        self
    }
}

impl Default for StatusBar {
    fn default() -> Self {
        Self::new()
    }
}

impl IntoElement for StatusBar {
    fn into_element(self) -> AnyElement {
        let group = |items: Vec<AnyElement>| div().flex_row().items_center().gap_3().children(items);
        div()
            .flex_col()
            .w_full()
            .h(px(25.0))
            .flex_shrink_0()
            .bg(Token::Surface)
            .child(horizontal_separator())
            .child(
                div()
                    .flex_1()
                    .flex_row()
                    .items_center()
                    .justify_between()
                    .px_3()
                    .text_xs()
                    .text_color(Token::TextMuted)
                    .child(group(self.left))
                    .child(group(self.right)),
            )
            .into_element()
    }
}