refactor(glossaire): extract entry relations rendering
This commit is contained in:
32
src/components/GlossaryRelationCards.astro
Normal file
32
src/components/GlossaryRelationCards.astro
Normal file
@@ -0,0 +1,32 @@
|
||||
---
|
||||
import type { GlossaryRelationBlock } from "../lib/glossary";
|
||||
import { hrefOfGlossaryEntry } from "../lib/glossary";
|
||||
|
||||
interface Props {
|
||||
relationBlocks: GlossaryRelationBlock[];
|
||||
}
|
||||
|
||||
const { relationBlocks = [] } = Astro.props;
|
||||
---
|
||||
|
||||
{relationBlocks.length > 0 && (
|
||||
<section class="glossary-relations" aria-label="Relations conceptuelles">
|
||||
<h2>Relations conceptuelles</h2>
|
||||
|
||||
<div class="glossary-relations-grid">
|
||||
{relationBlocks.map((block) => (
|
||||
<section class={`glossary-relations-card ${block.className}`}>
|
||||
<h3>{block.title}</h3>
|
||||
<ul>
|
||||
{block.items.map((item) => (
|
||||
<li>
|
||||
<a href={hrefOfGlossaryEntry(item)}>{item.data.term}</a>
|
||||
<span> — {item.data.definitionShort}</span>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</section>
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
)}
|
||||
Reference in New Issue
Block a user