Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions src/components/accordion/accordion.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
export interface Props {
title: string;
id: string;
}

const { title, id } = Astro.props;
---

<details class="group mb-4">
<summary
aria-expanded="false"
aria-controls={id}
class="cursor-pointer flex justify-between p-2 rounded-md border-t border-b focus:ring-2"
>
<span class="font-semibold">{title}</span>
<span aria-hidden="true" class="group-open:hidden">+</span>
<span aria-hidden="true" class="group-open:block hidden">−</span>
</summary>

<div id={id} class="pl-4">
<slot />
</div>
</details>
19 changes: 19 additions & 0 deletions src/content/pages/test.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -270,3 +270,22 @@ Barking up the right tree

## YouTube
<YouTube id="j5a0jTc9S10" alt="Mood lifter" />

## Accordion
#### What do the dogs say?

<Accordion title="Spanish-speaking dogs" id="spanish">
**Guau guau!**
</Accordion>

<Accordion title="Italian-speaking dogs" id="italian">
*Bau bau!*
</Accordion>

<Accordion title="Japanese-speaking dogs" id="japanese">
ワンワン
</Accordion>

<Accordion title="Finnish-speaking dogs" id="finnish">
***Hau hau!***
</Accordion>
2 changes: 2 additions & 0 deletions src/pages/[...slug].astro
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import BenefitsList from "../components/benefits-list/benefits-list.astro";
import BenefitItem from "../components/benefits-list/benefit-item.astro";
import { Note } from "../components/note";
import { SponsorTiers } from "../components/sponsor-tiers";
import Accordion from "../components/accordion/accordion.astro";

export async function getStaticPaths() {
const posts = await getCollection("pages");
Expand Down Expand Up @@ -44,6 +45,7 @@ const description = post.data.subtitle;
Note,
SponsorTiers,
hr: Separator,
Accordion
}}
/>
</Prose>
Expand Down