"use client"; import React, { useEffect, useRef, useState } from "react"; import { AnimatePresence, motion } from "motion/react"; import { IconMinus, IconPlus } from "@tabler/icons-react"; import { cn } from "@/lib/utils"; const FAQs = [ { question: "What is the purpose of this website?", answer: "This website is a place to help you find the best products and services in the world.", }, { question: "How do I contact support?", answer: "You can contact support by email at support@example.com or by phone at 123-456-7890.", }, { question: "How do I find the best products?", answer: "You can find the best products by searching for them on the search page or by browsing the categories.", }, { question: "Can I return a product?", answer: "Yes, you can return a product within 30 days of purchase. Please refer to our return policy for more details.", }, { question: "Do you offer international shipping?", answer: "Yes, we offer international shipping to most countries. Shipping fees and delivery times may vary depending on the destination.", }, { question: "How can I track my order?", answer: "You can track your order by logging into your account and visiting the order history page. You will also receive a tracking number via email once your order has shipped.", }, ]; export function FrequentlyAskedQuestionsAccordion() { const [open, setOpen] = useState(null); return (

Frequently asked questions

{FAQs.map((faq, index) => ( ))}
); } const FAQItem = ({ question, answer, setOpen, open, }: { question: string; answer: string; open: string | null; setOpen: (open: string | null) => void; }) => { const isOpen = open === question; return (
{ if (isOpen) { setOpen(null); } else { setOpen(question); } }} >

{question}

{isOpen && (

{answer}

)}
); };