Files
archicratie-edition/src/components/GlossaryCardGrid.astro
Archicratia 7187b69935
All checks were successful
SMOKE / smoke (push) Successful in 4s
CI / build-and-anchors (push) Successful in 45s
CI / build-and-anchors (pull_request) Successful in 48s
refactor(glossaire): componentize glossary home sections
2026-03-25 18:26:43 +01:00

83 lines
1.6 KiB
Plaintext

---
import { hrefOfGlossaryEntry, type GlossaryEntry } from "../lib/glossary";
export interface Props {
entries?: GlossaryEntry[];
wide?: boolean;
}
const {
entries = [],
wide = false,
} = Astro.props;
---
<div class="glossary-cards">
{entries.map((entry) => (
<a
class:list={[
"glossary-card",
wide && "glossary-card--wide",
]}
href={hrefOfGlossaryEntry(entry)}
>
<strong>{entry.data.term}</strong>
<span>{entry.data.definitionShort}</span>
</a>
))}
</div>
<style>
.glossary-cards{
display: grid;
grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
gap: 12px;
margin-top: 14px;
}
.glossary-card{
display: flex;
flex-direction: column;
gap: 8px;
padding: 14px 16px;
border: 1px solid var(--glossary-border);
border-radius: 18px;
background: var(--glossary-bg-soft);
text-decoration: none;
transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}
.glossary-card:hover{
transform: translateY(-1px);
background: var(--glossary-bg-soft-strong);
border-color: rgba(0,217,255,0.16);
text-decoration: none;
}
.glossary-card--wide{
grid-column: 1 / -1;
}
.glossary-card strong{
color: var(--glossary-accent);
font-size: 1.04rem;
line-height: 1.28;
}
.glossary-card span{
color: inherit;
font-size: 1rem;
line-height: 1.5;
opacity: .94;
}
@media (prefers-color-scheme: dark){
.glossary-card{
background: rgba(255,255,255,0.04);
}
.glossary-card:hover{
background: rgba(255,255,255,0.07);
}
}
</style>