11import React , { useState } from "react" ;
22import { FiChevronDown } from "react-icons/fi" ;
33import { motion } from "framer-motion" ;
4+ import { useColorMode } from "@docusaurus/theme-common" ; // Docusaurus theme detection
45
56const faqData = [
67 {
@@ -42,24 +43,38 @@ const faqData = [
4243
4344const FAQs : React . FC = ( ) => {
4445 const [ activeIndex , setActiveIndex ] = useState < number | null > ( null ) ;
46+ const { colorMode } = useColorMode ( ) ;
47+ const isDark = colorMode === "dark" ;
4548
4649 const toggleAccordion = ( index : number ) => {
4750 setActiveIndex ( activeIndex === index ? null : index ) ;
4851 } ;
4952
5053 return (
51- < section className = "py-8 bg-gray-50" >
54+ < section
55+ className = { `py-8 transition-colors duration-300 ${
56+ isDark ? "bg-[#121212]" : "bg-gray-50"
57+ } `}
58+ >
5259 < div className = "mx-auto px-2 sm:px-4 lg:px-6" >
5360 < div className = "flex flex-col justify-center items-center gap-x-8 gap-y-12 xl:gap-28 lg:flex-row lg:justify-between" >
5461 < div className = "w-full" >
5562 < div className = "mb-8 lg:mb-16" >
5663 < h6 className = "text-lg text-center lg:text-left font-medium text-indigo-600 mb-2" >
5764 FAQs
5865 </ h6 >
59- < h2 className = "text-4xl text-center lg:text-left font-bold text-gray-900 dark:text-gray-100 leading-snug" >
66+ < h2
67+ className = { `text-4xl text-center lg:text-left font-bold ${
68+ isDark ? "text-gray-100" : "text-gray-900"
69+ } leading-snug`}
70+ >
6071 Looking for answers?
6172 </ h2 >
62- < p className = "text-gray-600 dark:text-gray-400 text-center lg:text-left" >
73+ < p
74+ className = { `${
75+ isDark ? "text-gray-400" : "text-gray-600"
76+ } text-center lg:text-left`}
77+ >
6378 Find answers to the most common questions about Recode Hive.
6479 </ p >
6580 </ div >
@@ -75,15 +90,19 @@ const FAQs: React.FC = () => {
7590 transition = { { duration : 0.3 } }
7691 >
7792 < button
78- className = "accordion-toggle group flex justify-between items-center text-lg font-medium text-gray-700 dark:text-gray-200 w-full transition-all duration-300 hover:text-indigo-600 dark:hover:text-indigo-400 bg-gray-100 dark:bg-gray-800 p-4 rounded-lg focus:outline-none"
93+ className = { `accordion-toggle group flex justify-between items-center text-lg font-medium w-full transition-all duration-300
94+ ${
95+ isDark
96+ ? "text-gray-200 bg-gray-800 hover:text-indigo-400"
97+ : "text-gray-700 bg-gray-100 hover:text-indigo-600"
98+ }
99+ p-4 rounded-lg focus:outline-none` }
79100 onClick = { ( ) => toggleAccordion ( index ) }
80101 >
81102 { faq . question }
82103 < motion . span
83104 className = "transform transition-transform duration-300"
84- animate = { {
85- rotate : activeIndex === index ? 180 : 0 ,
86- } }
105+ animate = { { rotate : activeIndex === index ? 180 : 0 } }
87106 >
88107 < FiChevronDown size = { 22 } />
89108 </ motion . span >
@@ -97,8 +116,14 @@ const FAQs: React.FC = () => {
97116 } }
98117 transition = { { duration : 0.3 , ease : "easeInOut" } }
99118 >
100- < div
101- className = "mt-2 text-gray-600 dark:text-gray-400 text-base [&_a]:text-indigo-600 [&_a]:hover:text-indigo-800 dark:[&_a]:text-indigo-400 dark:[&_a]:hover:text-indigo-300 [&_a]:transition-colors [&_a]:duration-200 [&_strong]:font-semibold [&_strong]:text-gray-800 dark:[&_strong]:text-gray-200"
119+ < div
120+ className = { `mt-2 text-base transition-colors duration-200 ${
121+ isDark ? "text-gray-400" : "text-gray-600"
122+ }
123+ [&_a]:text-indigo-600 [&_a]:hover:text-indigo-800
124+ dark:[&_a]:text-indigo-400 dark:[&_a]:hover:text-indigo-300
125+ [&_strong]:font-semibold [&_strong]:text-gray-800
126+ dark:[&_strong]:text-gray-200` }
102127 dangerouslySetInnerHTML = { { __html : faq . answer } }
103128 />
104129 </ motion . div >
0 commit comments