diff --git a/components/defaultLanding/FAQSection.tsx b/components/defaultLanding/FAQSection.tsx index ce0fc77b9..623d68a4c 100644 --- a/components/defaultLanding/FAQSection.tsx +++ b/components/defaultLanding/FAQSection.tsx @@ -1,3 +1,4 @@ +import { useState } from 'react'; import { useTranslation } from 'next-i18next'; import { Card } from 'react-daisyui'; @@ -5,6 +6,12 @@ import faqs from './data/faq.json'; const FAQSection = () => { const { t } = useTranslation('common'); + const [openFAQ, setOpenFAQ] = useState(null); + + const handleToggle = (index) => { + setOpenFAQ(openFAQ === index ? null : index); + }; + return (
@@ -16,13 +23,31 @@ const FAQSection = () => { industry.

-
+
{faqs.map((faq, index) => { + const isOpen = openFAQ === index; return ( - - - Q. {faq.question} -

A. {faq.answer}

+ + + handleToggle(index)} + > + Q. {faq.question} + +
+

+ A. {faq.answer} +

+
);