diff --git a/src/components/common/navbar/index.tsx b/src/components/common/navbar/index.tsx index 3d88696..2f2cbad 100644 --- a/src/components/common/navbar/index.tsx +++ b/src/components/common/navbar/index.tsx @@ -40,9 +40,19 @@ const Navbar = () => { const links = [ { href: "/", label: t("home"), external: false, isHashLink: false }, { href: "/#core-team", label: t("core_team"), external: false, isHashLink: true }, + { href: "/#faq", label: "FAQ", external: false, isHashLink: true }, { href: "/contributors", label: t("contributors"), external: false, isHashLink: false }, { href: "/events", label: t("events"), external: false, isHashLink: false }, ]; + const handleFAQClick = () => { + setActiveSection(true); + if (pathname === "/") { + const el = document.getElementById("faq"); + if (el) el.scrollIntoView({ behavior: "smooth" }); + } else { + router.push("/#faq"); + } + }; const handleJoinClick = () => { trackGAEvent("join_community_click", { @@ -98,18 +108,35 @@ const Navbar = () => { // Use NextLink for external or hash links, use localized Link otherwise const LinkComponent = l.external || l.isHashLink ? NextLink : Link; - return l.isHashLink ? ( - - {l.label} - - ) : ( + if (l.isHashLink && l.href === "/#core-team") { + return ( + + {l.label} + + ); + } + if (l.isHashLink && l.href === "/#faq") { + return ( + + {l.label} + + ); + } + return ( { checkPath === "/" ? pathname === checkPath : pathname.startsWith(checkPath); const LinkComponent = l.external || l.isHashLink ? NextLink : Link; - return l.isHashLink ? ( - - {l.label} - - ) : ( + if (l.isHashLink && l.href === "/#core-team") { + return ( + + {l.label} + + ); + } + if (l.isHashLink && l.href === "/#faq") { + return ( + + {l.label} + + ); + } + return ( { + const [openIndex, setOpenIndex] = useState(null); + + const toggleFAQ = (idx: number) => { + setOpenIndex(openIndex === idx ? null : idx); + }; + + return ( + + + + + Frequently Asked Questions + + + + {faqData.map((faq, idx) => ( + + toggleFAQ(idx)} + aria-expanded={openIndex === idx} + aria-controls={`faq-panel-${idx}`} + > + + {faq.question} + + + + + + + {faq.answer} + + + ))} + + + + ); +}; + +export default FAQSection; diff --git a/src/modules/home/index.tsx b/src/modules/home/index.tsx index 0a7f5b2..ffa88de 100644 --- a/src/modules/home/index.tsx +++ b/src/modules/home/index.tsx @@ -9,6 +9,7 @@ import BlogSection from "./(sections)/blogs"; import ChampionSection from "./(sections)/champions"; import CommunitySection from "./(sections)/community"; import EventsSection from "./(sections)/event"; +import FAQSection from "./(sections)/faq"; import HeroSection from "./(sections)/hero"; import SponsorsSection from "./(sections)/sponsors"; @@ -55,6 +56,9 @@ const LandingPage = async () => { + + + > ); };
{faq.answer}