diff --git a/src/components/sections/contact/ContactCenter.tsx b/src/components/sections/contact/ContactCenter.tsx index 4536d36..e0cae92 100644 --- a/src/components/sections/contact/ContactCenter.tsx +++ b/src/components/sections/contact/ContactCenter.tsx @@ -1,91 +1,131 @@ -'use client'; +"use client"; -import React, { useState } from 'react'; -import TextAnimation from '@/components/text/TextAnimation'; +import ContactForm from "@/components/form/ContactForm"; +import HeroBackgrounds, { type HeroBackgroundVariantProps } from "@/components/background/HeroBackgrounds"; +import { cls } from "@/lib/utils"; +import { LucideIcon } from "lucide-react"; +import { sendContactEmail } from "@/utils/sendContactEmail"; +import type { ButtonAnimationType } from "@/types/button"; + +type ContactCenterBackgroundProps = Extract< + HeroBackgroundVariantProps, + | { variant: "plain" } + | { variant: "animated-grid" } + | { variant: "canvas-reveal" } + | { variant: "cell-wave" } + | { variant: "downward-rays-animated" } + | { variant: "downward-rays-animated-grid" } + | { variant: "downward-rays-static" } + | { variant: "downward-rays-static-grid" } + | { variant: "gradient-bars" } + | { variant: "radial-gradient" } + | { variant: "rotated-rays-animated" } + | { variant: "rotated-rays-animated-grid" } + | { variant: "rotated-rays-static" } + | { variant: "rotated-rays-static-grid" } + | { variant: "sparkles-gradient" } +>; interface ContactCenterProps { - tag: string; - title: string; - description: string; - background: { variant: string }; - useInvertedBackground: boolean; - inputPlaceholder?: string; - buttonText?: string; - termsText?: string; - onSubmit?: (email: string) => void; - className?: string; - containerClassName?: string; - contentClassName?: string; - tagClassName?: string; - titleClassName?: string; - descriptionClassName?: string; - formWrapperClassName?: string; - formClassName?: string; - inputClassName?: string; - buttonClassName?: string; - buttonTextClassName?: string; - termsClassName?: string; + title: string; + description: string; + tag: string; + tagIcon?: LucideIcon; + tagAnimation?: ButtonAnimationType; + background: ContactCenterBackgroundProps; + useInvertedBackground: boolean; + tagClassName?: string; + inputPlaceholder?: string; + buttonText?: string; + termsText?: string; + onSubmit?: (email: string) => void; + ariaLabel?: string; + className?: string; + containerClassName?: string; + contentClassName?: string; + titleClassName?: string; + descriptionClassName?: string; + formWrapperClassName?: string; + formClassName?: string; + inputClassName?: string; + buttonClassName?: string; + buttonTextClassName?: string; + termsClassName?: string; } -const ContactCenter: React.FC = ({ - tag, - title, - description, - background, - useInvertedBackground, - inputPlaceholder = 'Enter your email', - buttonText = 'Sign Up', - termsText = "By clicking Sign Up you're confirming that you agree with our Terms and Conditions.", onSubmit, - className = '', - containerClassName = '', - contentClassName = '', - tagClassName = '', - titleClassName = '', - descriptionClassName = '', - formWrapperClassName = '', - formClassName = '', - inputClassName = '', - buttonClassName = '', - buttonTextClassName = '', - termsClassName = '', -}) => { - const [email, setEmail] = useState(''); +const ContactCenter = ({ + title, + description, + tag, + tagIcon, + tagAnimation, + background, + useInvertedBackground, + tagClassName = "", + inputPlaceholder = "Enter your email", + buttonText = "Sign Up", + termsText = "By clicking Sign Up you're confirming that you agree with our Terms and Conditions.", + onSubmit, + ariaLabel = "Contact section", + className = "", + containerClassName = "", + contentClassName = "", + titleClassName = "", + descriptionClassName = "", + formWrapperClassName = "", + formClassName = "", + inputClassName = "", + buttonClassName = "", + buttonTextClassName = "", + termsClassName = "", +}: ContactCenterProps) => { - const handleSubmit = () => { - if (onSubmit && email) { - onSubmit(email); - } - }; + const handleSubmit = async (email: string) => { + try { + await sendContactEmail({ email }); + console.log("Email send successfully"); + } catch (error) { + console.error("Failed to send email:", error); + } + }; - return ( -
-
-
- {tag &&
{tag}
} - -

{description}

-
-
- setEmail(e.target.value)} - placeholder={inputPlaceholder} - className={inputClassName} - /> - + return ( +
+
+
+
+ +
+
+ +
+
-
- {termsText &&

{termsText}

} -
-
-
- ); + + ); }; +ContactCenter.displayName = "ContactCenter"; + export default ContactCenter;