🎨 [bootsier] Mejora menús desplegables Dropdown

This commit is contained in:
Manuel Cillero 2025-10-25 09:02:58 +02:00
parent 28f2703ef1
commit 76bece7540
8 changed files with 654 additions and 72 deletions

View file

@ -110,6 +110,35 @@ impl fmt::Display for BorderColor {
}
}
// **< ButtonColor >********************************************************************************
/// Variantes de color (`btn-*`) para **botones**.
///
/// - `Default` no añade clase (devuelve `""` para facilitar la composición de clases).
/// - `Background(Color)` genera `btn-{color}` (botón relleno).
/// - `Outline(Color)` genera `btn-outline-{color}` (contorno: texto y borde, fondo transparente).
/// - `Link` aplica estilo de enlace (`btn-link`), sin caja ni fondo, heredando el color de texto.
#[derive(AutoDefault)]
pub enum ButtonColor {
#[default]
Default,
Background(Color),
Outline(Color),
Link,
}
#[rustfmt::skip]
impl fmt::Display for ButtonColor {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::Default => Ok(()),
Self::Background(c) => write!(f, "btn-{c}"),
Self::Outline(c) => write!(f, "btn-outline-{c}"),
Self::Link => f.write_str("btn-link"),
}
}
}
// **< TextColor >**********************************************************************************
/// Colores de texto y fondos de texto (`text-*`).

View file

@ -0,0 +1,31 @@
use pagetop::prelude::*;
use std::fmt;
// **< ButtonSize >*********************************************************************************
/// Tamaño visual de un botón.
///
/// Controla la escala del botón según el diseño del tema:
///
/// - `Default`, tamaño por defecto del tema (no añade clase).
/// - `Small`, botón compacto.
/// - `Large`, botón destacado/grande.
#[derive(AutoDefault)]
pub enum ButtonSize {
#[default]
Default,
Small,
Large,
}
#[rustfmt::skip]
impl fmt::Display for ButtonSize {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::Default => Ok(()),
Self::Small => f.write_str("btn-sm"),
Self::Large => f.write_str("btn-lg"),
}
}
}