From 2caa1a5a5a0f5610c875247e5efe23a32875f307 Mon Sep 17 00:00:00 2001 From: Md Ashad Date: Tue, 24 Feb 2026 15:21:48 +0530 Subject: [PATCH] added the FAQs section --- src/components/common/navbar/index.tsx | 101 +++++++++++++++++------- src/modules/home/(sections)/faq-data.ts | 36 +++++++++ src/modules/home/(sections)/faq.tsx | 71 +++++++++++++++++ src/modules/home/index.tsx | 4 + 4 files changed, 185 insertions(+), 27 deletions(-) create mode 100644 src/modules/home/(sections)/faq-data.ts create mode 100644 src/modules/home/(sections)/faq.tsx 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 ? ( - - ) : ( + if (l.isHashLink && l.href === "/#core-team") { + return ( + + ); + } + if (l.isHashLink && l.href === "/#faq") { + return ( + + ); + } + return ( { checkPath === "/" ? pathname === checkPath : pathname.startsWith(checkPath); const LinkComponent = l.external || l.isHashLink ? NextLink : Link; - return l.isHashLink ? ( - - ) : ( + if (l.isHashLink && l.href === "/#core-team") { + return ( + + ); + } + if (l.isHashLink && l.href === "/#faq") { + return ( + + ); + } + return ( { + const [openIndex, setOpenIndex] = useState(null); + + const toggleFAQ = (idx: number) => { + setOpenIndex(openIndex === idx ? null : idx); + }; + + return ( +
+
+

+ + Frequently Asked Questions + +

+
+ {faqData.map((faq, idx) => ( +
+ +
+

{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 () => { + + + ); };