✨ (pagetop): Añade el componente Tile y Accent

Recuadro de acceso a una sección con icono, descripción, color de acento
e imagen de fondo difuminada; se oculta sin acceso a su ruta. Basic y
Bootsier definen las clases `accent-<color>`.
This commit is contained in:
Manuel Cillero 2026-11-23 02:59:42 +01:00
parent 4adb8cb1ec
commit ad80c09eff
13 changed files with 684 additions and 1 deletions

View file

@ -590,3 +590,119 @@ svg.icon {
@extend .alert;
@extend .alert-danger;
}
// Accent colors (`Accent`): every component that takes one adds the same `accent-<color>` class,
// which sets --bootsier-accent to the Bootstrap color of the same name (lime and magenta are added
// by Bootsier, see _bootsier-variables.scss). The styles of each component only read that variable.
// Quoted: unquoted, Sass reads names such as `yellow` or `cyan` as colors, not as text.
@each $name in "blue", "indigo", "purple", "magenta", "pink", "red", "orange", "yellow", "lime",
"green", "teal", "cyan", "gray" {
.accent-#{$name} {
--bootsier-accent: var(--bs-#{$name});
}
}
// Access tiles (Tile): a large link with white text over its accent color and, when it has one, a
// blurred background image. The image goes below a veil of the accent color (from translucent to
// darkened), so the text keeps its contrast whatever the picture. The icon stays at the top and the
// texts at the bottom (also without an icon), so the icons of a row line up whatever the length of
// the descriptions.
.tile {
// The accent of the tile (`accent-<color>`, see above), with a fallback.
--tile-accent: var(--bootsier-accent, var(--bs-primary));
position: relative;
isolation: isolate;
display: flex;
flex-direction: column;
min-height: 11rem;
padding: $spacer * 1.5;
overflow: hidden;
color: $white;
text-decoration: none;
background-color: var(--tile-accent);
border-radius: var(--bs-border-radius-xl);
box-shadow: var(--bs-box-shadow-sm);
transition: transform .2s ease, box-shadow .2s ease;
&::before {
content: "";
position: absolute;
inset: 0;
z-index: -1;
background: linear-gradient(
135deg,
color-mix(in srgb, var(--tile-accent) 75%, transparent),
color-mix(in srgb, var(--tile-accent) 55%, #000)
);
}
// Scaled up a little so that the blur does not leave light edges.
> .tile-image {
position: absolute;
inset: 0;
z-index: -2;
width: 100%;
height: 100%;
object-fit: cover;
filter: blur(3px) saturate(80%);
transform: scale(1.08);
transition: transform .4s ease;
}
&:hover,
&:focus-visible {
color: $white;
transform: translateY(-.25rem);
box-shadow: var(--bs-box-shadow);
> .tile-image {
transform: scale(1.15);
}
}
&:focus-visible {
outline: 3px solid var(--tile-accent);
outline-offset: 3px;
}
// Disabled (`Tile::with_disabled()`): dimmed, without a link and without reacting to the pointer.
&.disabled {
pointer-events: none;
opacity: $btn-disabled-opacity;
box-shadow: none;
}
@media (prefers-reduced-motion: reduce) {
&,
> .tile-image {
transition: none;
}
}
}
.tile-body {
flex-grow: 1;
display: flex;
flex-direction: column;
justify-content: flex-end;
gap: $spacer * .25;
text-shadow: 0 1px 3px rgba($black, .4);
}
.tile-icon {
margin-bottom: auto;
padding-bottom: $spacer;
font-size: 2.5rem;
line-height: 1;
}
.tile-title {
font-size: $h4-font-size;
font-weight: $font-weight-semibold;
line-height: $headings-line-height;
}
.tile-description {
font-size: .9375rem;
opacity: .9;
}

View file

@ -22,6 +22,11 @@ $info: #4cb5c4; // Teal of the screens in the Intro illustration.
$light: #fff1db; // Cream of the Intro blocks.
$dark: #1a202c; // Text color of Intro.
// Accent colors (`Accent`) that Bootstrap lacks, added to its $colors map in bootsier.scss so that
// they get their own --bs-lime and --bs-magenta like the others. Same tones as in Basic.
$lime: #65a30d;
$magenta: #c026d3;
// Filled form fields: text fields, dropdowns and checks take a gray background, one for each color
// mode (--bootsier-input-bg, declared in _bootsier-custom.scss), and the same color as their
// border, which only shows when it changes color (validation). Checked checks already take the

View file

@ -16,6 +16,12 @@
@import "bootstrap-5.3.8/scss/mixins";
@import "bootstrap-5.3.8/scss/utilities";
// Bootsier additions to the Bootstrap maps
// ---------------------------------------------------
// The accent colors that Bootstrap lacks (see _bootsier-variables.scss). Only `root` uses $colors,
// to declare the --bs-* variables, so they must be added before importing it.
$colors: map-merge($colors, ("lime": $lime, "magenta": $magenta));
// Bootstrap Layout & components
// No "grid": page layout comes from PageTop's own Flex and Grid components.
@import "bootstrap-5.3.8/scss/root";