Files
parsshop/components/faq.tsx
haniyeroozmand 8b733c817c first commit
2026-03-21 18:58:07 +03:30

38 lines
893 B
TypeScript

"use client";
import { useState } from "react";
import { Plus, Minus } from "lucide-react";
interface FAQItemProps {
question: string;
answer: string;
}
export default function FAQItem({ question, answer }: FAQItemProps) {
const [open, setOpen] = useState(false);
return (
<div className="border border-gray-200 rounded-lg bg-white">
{/* question */}
<button
onClick={() => setOpen(!open)}
className="w-full flex items-center justify-between p-5 text-right cursor-pointer"
>
<span className="text-sm font-medium">{question}</span>
<span className="text-amber-500">
{open ? <Minus size={18} /> : <Plus size={18} />}
</span>
</button>
{/* answer */}
{open && (
<div className="px-5 pb-5 text-sm text-gray-500 leading-7">
{answer}
</div>
)}
</div>
);
}