website/components/ContactSection.tsx

237 lines
11 KiB
TypeScript
Raw Normal View History

2025-11-06 12:02:10 +00:00
"use client";
import { motion, useInView } from "framer-motion";
import { useRef, useState } from "react";
import { Send } from "lucide-react";
2025-11-06 12:02:10 +00:00
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Textarea } from "@/components/ui/textarea";
import { Card, CardContent } from "@/components/ui/card";
import { toast } from "sonner";
import { useAppTheme } from "@/components/ThemeProvider";
import { submitContactForm } from "@/lib/actions/auth";
2025-11-06 12:02:10 +00:00
export function ContactSection() {
const ref = useRef(null);
const isInView = useInView(ref, { once: true, margin: "-100px" });
const { theme } = useAppTheme();
const isDark = theme === "dark";
2025-11-06 12:02:10 +00:00
const [formData, setFormData] = useState({
name: "",
email: "",
phone: "",
message: "",
});
const [isSubmitting, setIsSubmitting] = useState(false);
2025-11-06 12:02:10 +00:00
const handleSubmit = async (e: React.FormEvent) => {
2025-11-06 12:02:10 +00:00
e.preventDefault();
setIsSubmitting(true);
try {
await submitContactForm(formData);
toast.success("Message Sent Successfully", {
description: "Thank you for reaching out. We'll get back to you soon!",
});
setFormData({ name: "", email: "", phone: "", message: "" });
} catch (error) {
const errorMessage = error instanceof Error ? error.message : "Failed to send message. Please try again.";
toast.error("Error Sending Message", {
description: errorMessage,
});
} finally {
setIsSubmitting(false);
}
2025-11-06 12:02:10 +00:00
};
return (
<section id="contact" className="relative overflow-hidden py-20" ref={ref}>
{/* Background Image */}
<div
className="absolute inset-0 z-0"
style={{
// backgroundImage: `url('https://images.unsplash.com/photo-1556761175-5973dc0f32e7?ixlib=rb-4.0.3&auto=format&fit=crop&w=2070&q=80')`,
backgroundSize: 'cover',
backgroundPosition: 'center',
backgroundRepeat: 'no-repeat',
}}
/>
{/* Subtle overlay for readability - keeping background image clearly visible */}
<div
className="absolute inset-0 z-[1]"
style={{
backgroundColor: isDark ? 'rgba(0, 0, 0, 0.35)' : 'rgba(255, 255, 255, 0.30)'
}}
/>
{/* Very subtle gradient overlay */}
2025-11-06 12:02:10 +00:00
{!isDark && (
<div className="absolute inset-0 z-[2] bg-gradient-to-br from-rose-50/20 via-pink-50/15 to-orange-50/20" />
2025-11-06 12:02:10 +00:00
)}
{isDark && (
<div className="absolute inset-0 z-[2] bg-gradient-to-br from-gray-900/25 via-gray-800/20 to-gray-900/25" />
2025-11-06 12:02:10 +00:00
)}
{/* Subtle animated blobs */}
<div className="absolute inset-0 z-[3] overflow-hidden">
2025-11-06 12:02:10 +00:00
<motion.div
className={`absolute -top-10 left-10 h-64 w-64 rounded-full blur-3xl ${isDark ? "bg-pink-900/30 opacity-50" : "bg-pink-100 opacity-40"}`}
2025-11-06 12:02:10 +00:00
animate={{ x: [0, 60, 0], y: [0, 40, 0], scale: [1, 1.05, 1] }}
transition={{ duration: 18, repeat: Infinity, ease: "easeInOut" }}
/>
<motion.div
className={`absolute -bottom-10 right-10 h-72 w-72 rounded-full blur-3xl ${isDark ? "bg-orange-900/30 opacity-50" : "bg-orange-100 opacity-40"}`}
2025-11-06 12:02:10 +00:00
animate={{ x: [0, -60, 0], y: [0, -40, 0], scale: [1, 1.08, 1] }}
transition={{ duration: 22, repeat: Infinity, ease: "easeInOut" }}
/>
</div>
<div className="container mx-auto px-4 relative z-10 text-foreground">
<motion.div
initial={{ opacity: 0, y: 30 }}
animate={isInView ? { opacity: 1, y: 0 } : {}}
transition={{ duration: 0.6 }}
className="mb-16 text-center"
>
<h2 className="text-3xl sm:text-4xl md:text-5xl font-bold mb-4 bg-gradient-to-r from-rose-600 via-pink-600 to-orange-600 bg-clip-text text-transparent px-4">
2025-11-06 12:02:10 +00:00
Get in Touch
</h2>
<div className="mx-auto mb-4 sm:mb-6 h-1 w-20 sm:w-24 rounded-full bg-gradient-to-r from-rose-500 to-pink-600" />
<p className="mx-auto max-w-2xl text-base sm:text-lg text-muted-foreground px-4">
2025-11-06 12:02:10 +00:00
Ready to start your journey? Reach out to schedule a consultation.
</p>
</motion.div>
<div className="grid gap-8 sm:gap-10 lg:gap-12 lg:grid-cols-2 lg:items-stretch">
2025-11-06 12:02:10 +00:00
{/* Left: Illustration replacing cards */}
<motion.div
initial={{ opacity: 0, x: -50 }}
animate={isInView ? { opacity: 1, x: 0 } : {}}
transition={{ duration: 0.6, delay: 0.2 }}
className="relative flex"
2025-11-06 12:02:10 +00:00
>
2025-11-07 21:37:43 +00:00
<Card className="bg-gradient-to-br from-rose-100/15 via-pink-100/15 to-orange-100/15 dark:from-rose-900/15 dark:via-pink-900/15 dark:to-orange-900/15 backdrop-blur-sm border border-border/50 overflow-hidden relative h-full flex flex-col rounded-3xl">
<CardContent className="p-0 flex-1 flex flex-col">
{/* Background image for the card */}
<div
className="absolute inset-0 z-0 rounded-3xl"
style={{
// backgroundImage: `url('https://images.unsplash.com/photo-1573496359142-b8d87734a5a2?ixlib=rb-4.0.3&auto=format&fit=crop&w=1000&q=80')`,
backgroundSize: 'cover',
backgroundPosition: 'center',
backgroundRepeat: 'no-repeat',
opacity: 0.3,
}}
/>
{/* Content */}
<div className="relative z-10 p-6 flex-1 flex flex-col">
{/* Image and text side by side */}
<div className="flex flex-col sm:flex-row items-center sm:items-start gap-6 flex-1">
{/* Modern therapy-related illustration */}
<div className="relative flex-shrink-0">
<img
src="/mmmfil.jpeg"
alt="Nathalie Mac Guffie, LCSW - Your therapist"
className="w-32 h-32 sm:w-40 sm:h-40 md:w-48 md:h-48 select-none rounded-full object-cover shadow-lg"
loading="lazy"
/>
<motion.div
className="pointer-events-none absolute inset-0 rounded-full"
animate={{ opacity: [0.3, 0.6, 0.3] }}
transition={{ duration: 3, repeat: Infinity }}
style={{ background: "radial-gradient(circle, rgba(244,114,182,0.15), transparent 70%), radial-gradient(circle, rgba(251,146,60,0.12), transparent 70%)" }}
/>
</div>
{/* Text content */}
<div className="flex-1 text-center sm:text-left flex flex-col justify-center">
<h3 className="text-xl sm:text-2xl font-bold mb-3 sm:mb-4 text-foreground">Let's Begin Your Healing Journey</h3>
<div className="space-y-2 sm:space-y-3 text-sm sm:text-base text-muted-foreground leading-relaxed">
<p>
Taking the first step toward therapy can feel daunting, but you're not alone. I'm here to support
you through every stage of your journey toward wellness and growth.
</p>
<p>
Whether you're seeking help for yourself or your child, I provide a warm, non-judgmental space where
healing can begin. My approach is relationship-based and tailored to meet your unique needs.
</p>
<p>
Reach out today to schedule a consultation. Together, we can explore how therapy can support you
in creating positive change and building resilience.
</p>
</div>
</div>
</div>
2025-11-06 12:02:10 +00:00
</div>
</CardContent>
</Card>
</motion.div>
{/* Right: Contact form */}
<motion.div
initial={{ opacity: 0, x: 50 }}
animate={isInView ? { opacity: 1, x: 0 } : {}}
transition={{ duration: 0.6, delay: 0.4 }}
>
<Card className="border border-border/50 bg-card/70 backdrop-blur-sm">
<CardContent className="p-4 sm:p-6 md:p-8">
<h3 className="mb-4 sm:mb-6 text-xl sm:text-2xl font-bold text-foreground">Send a Message</h3>
2025-11-06 12:02:10 +00:00
<form onSubmit={handleSubmit} className="space-y-4">
<div>
<Input
placeholder="Your Name"
value={formData.name}
onChange={(e) => setFormData({ ...formData, name: e.target.value })}
required
className="bg-card text-foreground dark:text-zinc-100 placeholder:text-muted-foreground dark:placeholder:text-zinc-400 border-border focus-visible:ring-rose-500"
/>
</div>
<div>
<Input
type="email"
placeholder="Email Address"
value={formData.email}
onChange={(e) => setFormData({ ...formData, email: e.target.value })}
required
className="bg-card text-foreground dark:text-zinc-100 placeholder:text-muted-foreground dark:placeholder:text-zinc-400 border-border focus-visible:ring-rose-500"
/>
</div>
<div>
<Input
type="tel"
placeholder="Phone Number"
value={formData.phone}
onChange={(e) => setFormData({ ...formData, phone: e.target.value })}
className="bg-card text-foreground dark:text-zinc-100 placeholder:text-muted-foreground dark:placeholder:text-zinc-400 border-border focus-visible:ring-rose-500"
/>
</div>
<div>
<Textarea
placeholder="Tell me a bit about what brings you to therapy..."
rows={6}
value={formData.message}
onChange={(e) => setFormData({ ...formData, message: e.target.value })}
required
className="bg-card text-foreground dark:text-zinc-100 placeholder:text-muted-foreground dark:placeholder:text-zinc-400 border-border focus-visible:ring-rose-500"
/>
</div>
<Button
type="submit"
disabled={isSubmitting}
className="w-full cursor-pointer bg-gradient-to-r from-rose-500 to-pink-600 text-white transition-all hover:from-rose-600 hover:to-pink-700 hover:scale-[1.02] disabled:opacity-50 disabled:cursor-not-allowed"
2025-11-06 12:02:10 +00:00
size="lg"
>
<Send className="mr-2 h-5 w-5" />
{isSubmitting ? "Sending..." : "Send Message"}
2025-11-06 12:02:10 +00:00
</Button>
</form>
</CardContent>
</Card>
</motion.div>
</div>
</div>
</section>
);
}