'use client'
import { useState } from 'react'
import { ChevronRight } from 'lucide-react'
import { serializeJsonLd } from '@/lib/json-ld'
import { cn } from '@/lib/utils'
interface FAQItem {
question: string
answer: string
}
interface FAQProps {
items: FAQItem[]
title?: string
}
function FAQItemRow({
item,
isOpen,
onToggle,
}: {
item: FAQItem
isOpen: boolean
onToggle: () => void
}) {
return (
)
}
export function FAQ({ items, title = 'Common Questions' }: FAQProps) {
const [openIndex, setOpenIndex] = useState(null)
const faqSchema = {
'@context': 'https://schema.org',
'@type': 'FAQPage',
mainEntity: items.map((item) => ({
'@type': 'Question',
name: item.question,
acceptedAnswer: {
'@type': 'Answer',
text: item.answer,
},
})),
}
return (
{title}
{items.map((item, index) => (
setOpenIndex(openIndex === index ? null : index)}
/>
))}
)
}