diff --git a/src/components/sections/contact/ContactFaq.tsx b/src/components/sections/contact/ContactFaq.tsx index 517183e..386489a 100644 --- a/src/components/sections/contact/ContactFaq.tsx +++ b/src/components/sections/contact/ContactFaq.tsx @@ -1,32 +1,188 @@ -import React, { useRef } from 'react'; -import { useCardAnimation, UseCardAnimationOptions } from '@/hooks/useCardAnimation'; +"use client"; -interface ContactFaqProps { - faqs: Array<{ id: string; title: string; content: string }>; - containerClassName?: string; +import { useState, Fragment } from "react"; +import { cls, shouldUseInvertedText } from "@/lib/utils"; +import { getButtonProps } from "@/lib/buttonUtils"; +import Accordion from "@/components/Accordion"; +import Button from "@/components/button/Button"; +import { useCardAnimation } from "@/components/cardStack/hooks/useCardAnimation"; +import { useTheme } from "@/providers/themeProvider/ThemeProvider"; +import type { LucideIcon } from "lucide-react"; +import type { InvertedBackground } from "@/providers/themeProvider/config/constants"; +import type { CardAnimationType } from "@/components/cardStack/types"; +import type { ButtonConfig } from "@/types/button"; + +interface FaqItem { + id: string; + title: string; + content: string; } -export const ContactFaq: React.FC = ({ faqs, containerClassName = '' }) => { - const containerRef = useRef(null); - const itemRefs = useRef<(HTMLDivElement | null)[]>([]); +interface ContactFaqProps { + faqs: FaqItem[]; + ctaTitle: string; + ctaDescription: string; + ctaButton: ButtonConfig; + ctaIcon: LucideIcon; + useInvertedBackground: InvertedBackground; + animationType: CardAnimationType; + accordionAnimationType?: "smooth" | "instant"; + showCard?: boolean; + ariaLabel?: string; + className?: string; + containerClassName?: string; + ctaPanelClassName?: string; + ctaIconClassName?: string; + ctaTitleClassName?: string; + ctaDescriptionClassName?: string; + ctaButtonClassName?: string; + ctaButtonTextClassName?: string; + faqsPanelClassName?: string; + faqsContainerClassName?: string; + accordionClassName?: string; + accordionTitleClassName?: string; + accordionIconContainerClassName?: string; + accordionIconClassName?: string; + accordionContentClassName?: string; + separatorClassName?: string; +} - const animationOptions: UseCardAnimationOptions = { - containerRef, - itemRefs, +const ContactFaq = ({ + faqs, + ctaTitle, + ctaDescription, + ctaButton, + ctaIcon: CtaIcon, + useInvertedBackground, + animationType, + accordionAnimationType = "smooth", + showCard = true, + ariaLabel = "Contact and FAQ section", + className = "", + containerClassName = "", + ctaPanelClassName = "", + ctaIconClassName = "", + ctaTitleClassName = "", + ctaDescriptionClassName = "", + ctaButtonClassName = "", + ctaButtonTextClassName = "", + faqsPanelClassName = "", + faqsContainerClassName = "", + accordionClassName = "", + accordionTitleClassName = "", + accordionIconContainerClassName = "", + accordionIconClassName = "", + accordionContentClassName = "", + separatorClassName = "", +}: ContactFaqProps) => { + const [activeIndex, setActiveIndex] = useState(null); + const theme = useTheme(); + const shouldUseLightText = shouldUseInvertedText(useInvertedBackground, theme.cardStyle); + const { itemRefs } = useCardAnimation({ animationType, itemCount: 2 }); + + const handleToggle = (index: number) => { + setActiveIndex(activeIndex === index ? null : index); }; - const { } = useCardAnimation(animationOptions); + const getButtonConfigProps = () => { + if (theme.defaultButtonVariant === "hover-bubble") { + return { bgClassName: "w-full" }; + } + if (theme.defaultButtonVariant === "icon-arrow") { + return { className: "justify-between" }; + } + return {}; + }; return ( -
- {faqs.map((faq) => ( -
-

{faq.title}

-

{faq.content}

+
+
+
+
{ itemRefs.current[0] = el; }} + className={cls( + "md:col-span-4 card rounded-theme-capped p-6 md:p-8 flex flex-col items-center justify-center gap-6 text-center", + ctaPanelClassName + )} + > +
+ +
+ +
+

+ {ctaTitle} +

+ +

+ {ctaDescription} +

+
+ +
+ +
{ itemRefs.current[1] = el; }} + className={cls( + "md:col-span-8 flex flex-col gap-4", + faqsPanelClassName + )} + > +
+ {faqs.map((faq, index) => ( + + + {!showCard && index < faqs.length - 1 && ( +
+ )} + + ))} +
+
- ))} -
+
+
); }; +ContactFaq.displayName = "ContactFaq"; + export default ContactFaq;