- Run record
- loading
Loading this Run…
Loading the Revisions of this Run…
A published source file of Revision 0 of Fjora — Taste the North 1.2.0, shown as text in the browser.
import { useState } from "react";
import { faqEntries } from "../data/copy";
export function Faq() {
const [openIndex, setOpenIndex] = useState<number | null>(null);
return (
<section className="faq" id="faq">
<div className="section-heading">
<h2>Questions</h2>
</div>
<div className="faq__list">
{faqEntries.map((entry, index) => {
const isOpen = openIndex === index;
const panelId = `faq-panel-${index}`;
const buttonId = `faq-button-${index}`;
return (
<div className="faq__item" key={entry.question}>
<h3 className="faq__question">
<button
type="button"
id={buttonId}
className="faq__trigger"
aria-expanded={isOpen}
aria-controls={panelId}
onClick={() => setOpenIndex(isOpen ? null : index)}
>
<span>{entry.question}</span>
<span className="faq__icon" aria-hidden="true">
{isOpen ? "−" : "+"}
</span>
</button>
</h3>
<div
id={panelId}
role="region"
aria-labelledby={buttonId}
className="faq__panel"
hidden={!isOpen}
>
<p>{entry.answer}</p>
</div>
</div>
);
})}
</div>
</section>
);
}Source is browser-viewable only. There is no download or archive endpoint, and no additional license is granted beyond inspection and research.