mediahub-fe/app/[locale]/(public)/faqs/page.tsx

66 lines
1.8 KiB
TypeScript
Raw Normal View History

"use client";
2024-12-17 14:27:48 +00:00
import { Reveal } from "@/components/landing-page/Reveal";
import React, { useState } from "react";
2025-02-15 14:43:19 +00:00
import { useTranslations } from "next-intl";
interface FAQItem {
question: string;
answer: string;
}
const FAQS: React.FC = () => {
2025-02-15 14:43:19 +00:00
const t = useTranslations("LandingPage");
const faqs: FAQItem[] = [
{
2025-02-15 14:43:19 +00:00
question: t("question1"),
answer: t("answer1"),
},
{
2025-02-15 14:43:19 +00:00
question: t("question2"),
answer: t("answer2"),
},
{
2025-02-15 14:43:19 +00:00
question: t("question3"),
answer: t("answer3"),
},
{
2025-02-15 14:43:19 +00:00
question: t("question4"),
answer: t("answer4"),
},
];
const [openIndex, setOpenIndex] = useState<number | null>(null);
const toggleFAQ = (index: number) => {
setOpenIndex(openIndex === index ? null : index);
};
return (
2024-12-17 14:27:48 +00:00
<div className="max-w-3xl mx-auto h-screen p-6 mt-20">
{/* Header */}
2024-12-17 14:27:48 +00:00
<Reveal>
<div className="flex items-center justify-center mb-6">
<img src="/assets/icons-faqs.png" alt="Faqs" />
<h2 className="ml-4 text-lg lg:text-2xl font-bold text-gray-800">Frequently Asked Questions</h2>
</div>
2024-12-17 14:27:48 +00:00
{/* FAQS Items */}
<div className="space-y-4">
2025-02-15 14:43:19 +00:00
{faqs?.map((faq, index) => (
2024-12-17 14:27:48 +00:00
<div key={index} className="border-b border-gray-300 pb-2 cursor-pointer">
<div className="flex justify-between items-center" onClick={() => toggleFAQ(index)}>
<h3 className="text-sm font-semibold text-gray-800">{faq.question}</h3>
<span className="text-gray-500 text-xl">{openIndex === index ? "" : "+"}</span>
</div>
{openIndex === index && <p className="text-gray-600 mt-2 text-sm">{faq.answer}</p>}
</div>
2024-12-17 14:27:48 +00:00
))}
</div>
</Reveal>
</div>
);
};
export default FAQS;