From 56eaa7211b69a2515ff8782fcc0ca946581626fb Mon Sep 17 00:00:00 2001 From: bender Date: Tue, 3 Mar 2026 04:58:50 +0000 Subject: [PATCH] Update src/components/sections/contact/ContactSplit.tsx --- .../sections/contact/ContactSplit.tsx | 161 ++++++++++-------- 1 file changed, 91 insertions(+), 70 deletions(-) diff --git a/src/components/sections/contact/ContactSplit.tsx b/src/components/sections/contact/ContactSplit.tsx index e1e1a21..1050c40 100644 --- a/src/components/sections/contact/ContactSplit.tsx +++ b/src/components/sections/contact/ContactSplit.tsx @@ -1,10 +1,14 @@ +"use client"; + import React, { useState } from "react"; -import { cn } from "@/lib/utils"; +import { Mail } from "lucide-react"; export interface ContactSplitProps { - tag?: string; + tag: string; title: string; description: string; + tagIcon?: React.ComponentType; + tagAnimation?: "none" | "opacity" | "slide-up" | "blur-reveal"; background?: { variant: string }; useInvertedBackground?: boolean; imageSrc?: string; @@ -17,10 +21,10 @@ export interface ContactSplitProps { buttonText?: string; termsText?: string; onSubmit?: (email: string) => void; + ariaLabel?: string; className?: string; containerClassName?: string; contentClassName?: string; - contactFormClassName?: string; tagClassName?: string; titleClassName?: string; descriptionClassName?: string; @@ -34,90 +38,107 @@ export interface ContactSplitProps { mediaClassName?: string; } -export const ContactSplit: React.FC = ({ - tag, - title, - description, - imageSrc, - videoSrc, - imageAlt = "", mediaPosition = "right", inputPlaceholder = "Enter your email", buttonText = "Sign Up", termsText, - useInvertedBackground = false, - className, - containerClassName, - contentClassName, - tagClassName, - titleClassName, - descriptionClassName, - formWrapperClassName, - formClassName, - inputClassName, - buttonClassName, - buttonTextClassName, - termsClassName, - mediaWrapperClassName, - mediaClassName -}) => { - const [email, setEmail] = useState(""); +const ContactSplit = React.forwardRef( + ( + { + tag, + title, + description, + tagIcon: TagIcon, + tagAnimation = "none", background, + useInvertedBackground = false, + imageSrc, + videoSrc, + imageAlt = "", videoAriaLabel = "Contact section video", mediaAnimation = "none", mediaPosition = "right", 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 = "", tagClassName = "", titleClassName = "", descriptionClassName = "", formWrapperClassName = "", formClassName = "", inputClassName = "", buttonClassName = "", buttonTextClassName = "", termsClassName = "", mediaWrapperClassName = "", mediaClassName = ""}, + ref + ) => { + const [email, setEmail] = useState(""); - const handleFormSubmit = (e: React.FormEvent) => { - e.preventDefault(); - setEmail(""); - }; + const handleSubmit = (e: React.FormEvent) => { + e.preventDefault(); + onSubmit?.(email); + setEmail(""); + }; - return ( -
-
-
- {mediaPosition === "left" && imageSrc && ( -
- {imageAlt} -
- )} + return ( +
+
+
+ {/* Text Content */} +
+ {tag && ( +
+ {TagIcon && } + {tag} +
+ )} +

+ {title} +

+

+ {description} +

-
- {tag &&

{tag}

} -

{title}

-

{description}

- -
-
+ setEmail(e.target.value)} - className={cn( - "w-full px-4 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-primary", inputClassName - )} + placeholder={inputPlaceholder} required + className={`w-full px-4 py-3 bg-secondary-cta text-foreground rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-cta ${inputClassName}`} /> -
-
+ - {termsText &&

{termsText}

} -
- - {mediaPosition === "right" && imageSrc && ( -
- {imageAlt} + {termsText && ( +

+ {termsText} +

+ )}
- )} + + {/* Media */} + {(imageSrc || videoSrc) && ( +
+ {videoSrc ? ( +
+ )} +
-
- ); -}; + ); + } +); + +ContactSplit.displayName = "ContactSplit"; export default ContactSplit;