♻️ [bootsier] Refactoriza y renombra estilos aux

This commit is contained in:
Manuel Cillero 2025-11-03 22:43:31 +01:00
parent 13fbdbe007
commit 6a4ad213d8
10 changed files with 267 additions and 223 deletions

View file

@ -17,12 +17,14 @@ const TOGGLE_OFFCANVAS: &str = "offcanvas";
#[rustfmt::skip]
#[derive(AutoDefault)]
pub struct Navbar {
id : AttrId,
classes : AttrClasses,
expand : BreakPoint,
layout : navbar::Layout,
position: navbar::Position,
items : Children,
id : AttrId,
classes : AttrClasses,
expand : BreakPoint,
layout : navbar::Layout,
position : navbar::Position,
style_bg : StyleBg,
style_text: StyleText,
items : Children,
}
impl Component for Navbar {
@ -48,6 +50,8 @@ impl Component for Navbar {
navbar::Position::StickyBottom => "sticky-bottom",
}
.to_string(),
self.style_bg().to_string(),
self.style_text().to_string(),
]
.join(" "),
);
@ -255,6 +259,28 @@ impl Navbar {
self
}
/// Establece el estilo del fondo ([`StyleBg`]).
#[builder_fn]
pub fn with_style_bg(mut self, style: StyleBg) -> Self {
self.style_bg = style;
self
}
/// Establece el estilo del texto ([`StyleText`]).
#[builder_fn]
pub fn with_style_text(mut self, style: StyleText) -> Self {
self.style_text = style;
self
}
/// Atajo para definir los estilos de fondo y texto a la vez.
#[builder_fn]
pub fn with_styles(mut self, style_bg: StyleBg, style_text: StyleText) -> Self {
self.style_bg = style_bg;
self.style_text = style_text;
self
}
/// Añade un nuevo contenido hijo.
#[inline]
pub fn add_item(mut self, item: navbar::Item) -> Self {
@ -291,6 +317,16 @@ impl Navbar {
&self.position
}
/// Devuelve el estilo del fondo del contenedor.
pub fn style_bg(&self) -> &StyleBg {
&self.style_bg
}
/// Devuelve el estilo del texto del contenedor.
pub fn style_text(&self) -> &StyleText {
&self.style_text
}
/// Devuelve la lista de contenidos (`children`).
pub fn items(&self) -> &Children {
&self.items