diff --git a/app/faq/page.tsx b/app/faq/page.tsx index d5c3f31..d59abd5 100644 --- a/app/faq/page.tsx +++ b/app/faq/page.tsx @@ -1,7 +1,7 @@ "use client"; -import React, { useEffect, useState } from "react"; -import Link from "next/link"; import { useTheme } from "next-themes"; +import Link from "next/link"; +import { useEffect, useState } from "react"; import NavbarComponent from "../front-navbar"; const faqs = [ @@ -57,6 +57,7 @@ const FAQ = () => { const { systemTheme, theme } = useTheme(); const currentTheme = theme === "dark" ? systemTheme : theme; const [darkMode, setDarkMode] = useState(false); + const [searchTerm, setSearchTerm] = useState(""); useEffect(() => { setDarkMode(currentTheme === 'dark'); @@ -66,6 +67,12 @@ const FAQ = () => { setActiveIndex(index === activeIndex ? null : index); }; + // Filter FAQs based on search term + const filteredFaqs = faqs.filter((faq) => + faq.question.toLowerCase().includes(searchTerm.toLowerCase()) || + faq.answer.toLowerCase().includes(searchTerm.toLowerCase()) + ); + return (
+ {faq.answer} +
+ )}- {faq.answer} -
- )} -+ No FAQs match your search. +
+ )}