✨ (pagetop): Añade puntos de corte a Flex/FlexItem
- `Breakpoint` gana variante `Xxxl` y métodos `name()`/`min_width()`/ `resolved()`, para consultarse contra el tema activo. - `Theme::breakpoint_entry()` sustituye a `breakpoint_min_width()`: devuelve un `BreakpointEntry` con nombre y ancho mínimo. - Nuevo `Responsive<T>`, valor en cascada mobile-first por punto de corte. - Ejemplo `examples/intro-responsive.rs` con los patrones de uso.
This commit is contained in:
parent
8577ca8a59
commit
0b8f3f3000
22 changed files with 1257 additions and 359 deletions
|
|
@ -207,28 +207,21 @@ pub enum Gap {
|
|||
}
|
||||
|
||||
impl Gap {
|
||||
// Declaraciones de estilo (propiedad, valor) para este espaciado; vacío si no hay ninguna
|
||||
// medible (`UnitValue::None`/`UnitValue::Auto` no producen ningún estilo).
|
||||
pub(super) fn styles(self) -> Vec<(&'static str, CowStr)> {
|
||||
// Declaraciones de estilo (propiedad, valor) para este espaciado; cada hueco a `None` si no hay
|
||||
// ninguna medible (`UnitValue::None`/`UnitValue::Auto` no producen ningún estilo).
|
||||
pub(super) fn styles(self) -> [Option<(&'static str, CowStr)>; 2] {
|
||||
match self {
|
||||
Self::None => Vec::new(),
|
||||
Self::Both(value) => {
|
||||
if value.is_measurable() {
|
||||
vec![("gap", value.into())]
|
||||
} else {
|
||||
Vec::new()
|
||||
}
|
||||
}
|
||||
Self::Distinct { row, column } => {
|
||||
let mut styles = Vec::new();
|
||||
if row.is_measurable() {
|
||||
styles.push(("row-gap", row.into()));
|
||||
}
|
||||
if column.is_measurable() {
|
||||
styles.push(("column-gap", column.into()));
|
||||
}
|
||||
styles
|
||||
}
|
||||
Self::None => [None, None],
|
||||
Self::Both(value) => [Self::style("gap", value), None],
|
||||
Self::Distinct { row, column } => [
|
||||
Self::style("row-gap", row),
|
||||
Self::style("column-gap", column),
|
||||
],
|
||||
}
|
||||
}
|
||||
|
||||
// Declaración (propiedad, valor) para un valor medible, o `None` si no lo es.
|
||||
fn style(property: &'static str, value: UnitValue) -> Option<(&'static str, CowStr)> {
|
||||
value.is_measurable().then(|| (property, value.into()))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue