⌘K
Search
Search pages, pieces and blocks.
FAQ/A Section header and six questions in an Accordion, in one column or beside the header on wide screens.
components/blocks/faq.tsx
"use client"
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "@/components/ui/accordion"import { PageHeader, PageHeaderContent, PageHeaderDescription, PageHeaderTitle,} from "@/components/ui/page-header"import { Text } from "@/components/ui/text"
// FAQ: a Section header and six Maré questions in an Accordion, the first// answer open. Two states: one column, the questions under the header; and// two columns, the header on the start side and the questions beside it from// 1024px (stacked below).
type FaqState = "one-column" | "two-columns"
const questions = [ { question: "What happens when the sea says no?", answer: "Every lesson sits on a weather hold. The school checks the forecast the evening before; when waves are too big or too flat, the lesson moves to the next free slot or the payment comes back in full.", }, { question: "Is the gear included?", answer: "Board, wetsuit and leash come with every lesson, sized at booking. Bring a towel, sun cream and water.", }, { question: "Can a first timer join?", answer: "Yes. Beginner lessons start on the sand, then move to white water on soft boards, with one instructor for every five students.", }, { question: "How early is arrival?", answer: "Fifteen minutes before the start, to change and meet the instructor. In Ericeira the meeting point is the Foz do Lizandro car park.", }, { question: "Can a lesson move or be cancelled?", answer: "Free of charge up to 24 hours before, from the booking page. After that, a lesson can still move once.", }, { question: "Do lessons run in winter?", answer: "All year. The water sits near 14 degrees in winter, so wetsuits are thicker and lessons run a little shorter.", },]
function FaqBlock({ state }: { state?: FaqState }) { const twoColumns = (state ?? "one-column") === "two-columns" return ( <section className="mx-auto w-full max-w-6xl px-6 py-16 md:py-24"> <div className={twoColumns ? "grid gap-10 lg:grid-cols-3 lg:gap-16" : "mx-auto flex max-w-2xl flex-col gap-10"}> <PageHeader align={twoColumns ? "start" : "center"}> <PageHeaderContent> <PageHeaderTitle level={2} size="heading">Before the first lesson</PageHeaderTitle> <PageHeaderDescription>Weather, gear, levels, and what happens when plans change.</PageHeaderDescription> </PageHeaderContent> </PageHeader> <Accordion defaultValue={[questions[0].question]} className={twoColumns ? "lg:col-span-2" : undefined}> {questions.map(({ question, answer }) => ( <AccordionItem key={question} value={question}> <AccordionTrigger>{question}</AccordionTrigger> <AccordionContent> <Text>{answer}</Text> </AccordionContent> </AccordionItem> ))} </Accordion> </div> </section> )}
export { FaqBlock }export type { FaqState }