| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- import { Plus } from 'lucide-react';
- import { cn } from '@/lib/utils';
- import type { FaqSection } from '../types';
- import { Container, SectionHeading } from '../ui';
-
- export function Faq({ section }: { section: FaqSection }) {
- const { heading, items } = section.content;
- const twoColumn = section.variant === 'two-column';
-
- return (
- <section
- id={section.id}
- className="sf-section scroll-mt-20 py-16 md:py-20"
- >
- <Container
- className={cn(
- twoColumn
- ? 'grid gap-10 md:grid-cols-[1fr_2fr]'
- : 'max-w-3xl',
- )}
- >
- <SectionHeading heading={heading} />
-
- <div
- className={cn(
- 'divide-y divide-(--sf-border) border-y border-(--sf-border)',
- !twoColumn && 'mt-8',
- )}
- >
- {items.map((item) => (
- <details key={item.question} className="group py-5">
- <summary className="flex cursor-pointer list-none items-center justify-between gap-4 font-medium [&::-webkit-details-marker]:hidden">
- {item.question}
- <Plus
- aria-hidden
- className="size-4 shrink-0 text-(--sf-muted) transition-transform group-open:rotate-45"
- />
- </summary>
- <p className="mt-3 max-w-2xl leading-relaxed text-(--sf-muted)">
- {item.answer}
- </p>
- </details>
- ))}
- </div>
- </Container>
- </section>
- );
- }
|