✨ (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:
parent
4adb8cb1ec
commit
ad80c09eff
13 changed files with 684 additions and 1 deletions
16
assets/scss/basic/_accent.scss
Normal file
16
assets/scss/basic/_accent.scss
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
// Accent colors (`Accent`): every component that takes one adds the same `accent-<color>` class,
|
||||
// which sets --val-color--accent to the tone of the theme for that color (`_root.scss`). The
|
||||
// styles of each component only read that variable.
|
||||
.accent-blue { --val-color--accent: var(--val-color--blue); }
|
||||
.accent-indigo { --val-color--accent: var(--val-color--indigo); }
|
||||
.accent-purple { --val-color--accent: var(--val-color--purple); }
|
||||
.accent-magenta { --val-color--accent: var(--val-color--magenta); }
|
||||
.accent-pink { --val-color--accent: var(--val-color--pink); }
|
||||
.accent-red { --val-color--accent: var(--val-color--red); }
|
||||
.accent-orange { --val-color--accent: var(--val-color--orange); }
|
||||
.accent-yellow { --val-color--accent: var(--val-color--yellow); }
|
||||
.accent-lime { --val-color--accent: var(--val-color--lime); }
|
||||
.accent-green { --val-color--accent: var(--val-color--green); }
|
||||
.accent-teal { --val-color--accent: var(--val-color--teal); }
|
||||
.accent-cyan { --val-color--accent: var(--val-color--cyan); }
|
||||
.accent-gray { --val-color--accent: var(--val-color--gray); }
|
||||
|
|
@ -17,6 +17,20 @@
|
|||
--val-color--info: #0dcaf0;
|
||||
--val-color--warning: #ffc107;
|
||||
--val-color--danger: #dc3545;
|
||||
// Accent Colors (`Accent`): no meaning, only to tell elements apart
|
||||
--val-color--blue: #0d6efd;
|
||||
--val-color--indigo: #6610f2;
|
||||
--val-color--purple: #6f42c1;
|
||||
--val-color--magenta: #c026d3;
|
||||
--val-color--pink: #d63384;
|
||||
--val-color--red: #dc3545;
|
||||
--val-color--orange: #fd7e14;
|
||||
--val-color--yellow: #ffc107;
|
||||
--val-color--lime: #65a30d;
|
||||
--val-color--green: #198754;
|
||||
--val-color--teal: #20c997;
|
||||
--val-color--cyan: #0dcaf0;
|
||||
--val-color--gray: #6c757d;
|
||||
// Other Colors
|
||||
--val-color--bg: #fafafa;
|
||||
--val-color--bg--muted: #dee2e6;
|
||||
|
|
|
|||
105
assets/scss/basic/_tile.scss
Normal file
105
assets/scss/basic/_tile.scss
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
// 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 `_accent.scss`), with a fallback.
|
||||
--tile-accent: var(--val-color--accent, var(--val-color--primary));
|
||||
position: relative;
|
||||
isolation: isolate;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 11rem;
|
||||
padding: 1.5rem;
|
||||
overflow: hidden;
|
||||
color: #fff;
|
||||
text-decoration: none;
|
||||
background-color: var(--tile-accent);
|
||||
border-radius: 0.75rem;
|
||||
box-shadow: 0 0.25rem 0.75rem rgb(0 0 0 / 15%);
|
||||
transition: transform 0.2s ease, box-shadow 0.2s ease;
|
||||
}
|
||||
|
||||
.tile::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 > .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 0.4s ease;
|
||||
}
|
||||
|
||||
.tile:hover,
|
||||
.tile:focus-visible {
|
||||
color: #fff;
|
||||
transform: translateY(-0.25rem);
|
||||
box-shadow: 0 0.75rem 1.5rem rgb(0 0 0 / 25%);
|
||||
}
|
||||
|
||||
.tile:hover > .tile-image,
|
||||
.tile:focus-visible > .tile-image {
|
||||
transform: scale(1.15);
|
||||
}
|
||||
|
||||
.tile:focus-visible {
|
||||
outline: 3px solid var(--tile-accent);
|
||||
outline-offset: 3px;
|
||||
}
|
||||
|
||||
.tile-body {
|
||||
flex-grow: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: flex-end;
|
||||
gap: 0.25rem;
|
||||
text-shadow: 0 1px 3px rgb(0 0 0 / 40%);
|
||||
}
|
||||
|
||||
.tile-icon {
|
||||
margin-bottom: auto;
|
||||
padding-bottom: 1rem;
|
||||
font-size: 2.5rem;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.tile-title {
|
||||
font-size: 1.375rem;
|
||||
font-weight: 600;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.tile-description {
|
||||
font-size: 0.9375rem;
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
// Disabled (`Tile::with_disabled()`): dimmed, without a link and without reacting to the pointer.
|
||||
.tile.disabled {
|
||||
pointer-events: none;
|
||||
opacity: 0.65;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.tile,
|
||||
.tile > .tile-image {
|
||||
transition: none;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue