"use client"; import { useState } from "react"; import { motion, AnimatePresence } from "framer-motion"; import { ChevronDown } from "lucide-react"; import { useTranslations } from "next-intl"; interface FaqItem { questionKey: string; answerKey: string; } interface FaqProps { items?: FaqItem[]; } export function FAQ({ items }: FaqProps) { const t = useTranslations(); const [openIndex, setOpenIndex] = useState(0); const defaultItems: FaqItem[] = [ { questionKey: "faq.items.0.question", answerKey: "faq.items.0.answer", }, { questionKey: "faq.items.1.question", answerKey: "faq.items.1.answer", }, { questionKey: "faq.items.2.question", answerKey: "faq.items.2.answer", }, ]; const faqItems = items || defaultItems; const containerVariants = { hidden: { opacity: 0 }, visible: { opacity: 1, transition: { staggerChildren: 0.1 }, }, }; const itemVariants = { hidden: { opacity: 0, y: 10 }, visible: { opacity: 1, y: 0 }, }; return (
{/* Header */}

{t("faq.title")}

{/* FAQ Items */} {faqItems.map((item, idx) => ( setOpenIndex(openIndex === idx ? null : idx)} className="w-full bg-gray-50 hover:bg-gray-100 transition-colors rounded-lg p-6 text-left" >

{t(item.questionKey)}

{openIndex === idx && (

{t(item.answerKey)}

)}
))}
); }