File tree Expand file tree Collapse file tree 3 files changed +32
-0
lines changed Expand file tree Collapse file tree 3 files changed +32
-0
lines changed Original file line number Diff line number Diff line change 1+ import { clsx } from "clsx" ;
2+
3+ export const Accordion = ( {
4+ title,
5+ children,
6+ id,
7+ } : {
8+ title : string ;
9+ children : React . ReactNode ;
10+ id : string ;
11+ } ) => {
12+ return (
13+ < details className = "group mb-4" >
14+ < summary
15+ aria-expanded = "false"
16+ aria-controls = { id }
17+ className = { clsx (
18+ "cursor-pointer flex justify-between p-2 rounded-md border-t border-b focus:ring-2"
19+ ) }
20+ >
21+ < span className = "font-semibold" > { title } </ span >
22+ < span aria-hidden = "true" className = "group-open:hidden" > +</ span >
23+ < span aria-hidden = "true" className = "group-open:block hidden" > −</ span >
24+ </ summary >
25+
26+ < div id = { id } className = "pl-4" > { children } </ div >
27+ </ details >
28+ ) ;
29+ } ;
Original file line number Diff line number Diff line change 1+ export { Accordion } from "./accordion" ;
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import BenefitItem from "../components/benefits-list/benefit-item.astro";
1414import { ButtonWithTitle } from " ../components/button-with-title" ;
1515import { Note } from " ../components/note" ;
1616import { SponsorTiers } from " ../components/sponsor-tiers" ;
17+ import { Accordion } from " ../components/accordion" ;
1718
1819export async function getStaticPaths() {
1920 const posts = await getCollection (" pages" );
@@ -48,6 +49,7 @@ const description = post.data.subtitle;
4849 Note ,
4950 SponsorTiers ,
5051 hr: Separator ,
52+ Accordion
5153 }}
5254 />
5355 </Prose >
You can’t perform that action at this time.
0 commit comments