import { useState } from 'react' import { motion } from 'framer-motion' import { FaEnvelope, FaMapMarkerAlt } from 'react-icons/fa' import { useNotification } from '../context/notification-context' const Contact = () => { const { showNotification } = useNotification() const [isSubmitting, setIsSubmitting] = useState(false) const [formData, setFormData] = useState({ name: '', email: '', message: '', website: '' // Honeypot field }) const handleSubmit = async (e: React.FormEvent) => { e.preventDefault() if (isSubmitting) return setIsSubmitting(true) try { const response = await fetch('/api/contact', { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify(formData), }) const data = await response.json() if (data.success) { showNotification('Message sent successfully!', 'success') setFormData({ name: '', email: '', message: '', website: '' }) } else { showNotification(data.message || 'Failed to send message', 'error') } } catch (error) { const errorMessage = error instanceof Error ? error.message : 'An error occurred. Please try again later.' showNotification(errorMessage, 'error') } finally { setTimeout(() => { setIsSubmitting(false) }, 1000) } } const contactInfo = [ { icon: , title: 'Email', content: 'contact@deafgain.com' }, { icon: , title: 'Location', content: 'Montana, United States' } ] return (

Get in Touch

We're here to help and answer any questions you might have

{contactInfo.map((info, index) => (
{info.icon}

{info.title}

{info.content}

))}
setFormData({ ...formData, name: e.target.value })} className="w-full px-4 py-3 border border-accent-lake rounded-lg focus:outline-none focus:border-primary text-base sm:text-lg" required minLength={2} maxLength={50} />
setFormData({ ...formData, email: e.target.value })} className="w-full px-4 py-3 border border-accent-lake rounded-lg focus:outline-none focus:border-primary text-base sm:text-lg" required pattern="[^@\s]+@[^@\s]+\.[^@\s]+" />
{/* Honeypot field - hidden from humans, visible to bots */}