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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { useState } from 'react';
|
| 2 |
+
import { Send, Mail, MapPin, Phone, Loader2, CheckCircle } from 'lucide-react';
|
| 3 |
+
|
| 4 |
+
export default function Contact() {
|
| 5 |
+
const [formData, setFormData] = useState({
|
| 6 |
+
name: '',
|
| 7 |
+
email: '',
|
| 8 |
+
subject: '',
|
| 9 |
+
message: ''
|
| 10 |
+
});
|
| 11 |
+
const [isSubmitting, setIsSubmitting] = useState(false);
|
| 12 |
+
const [isSubmitted, setIsSubmitted] = useState(false);
|
| 13 |
+
|
| 14 |
+
const handleSubmit = async (e) => {
|
| 15 |
+
e.preventDefault();
|
| 16 |
+
setIsSubmitting(true);
|
| 17 |
+
|
| 18 |
+
// Simulate API call
|
| 19 |
+
await new Promise(resolve => setTimeout(resolve, 1500));
|
| 20 |
+
|
| 21 |
+
setIsSubmitting(false);
|
| 22 |
+
setIsSubmitted(true);
|
| 23 |
+
setFormData({ name: '', email: '', subject: '', message: '' });
|
| 24 |
+
|
| 25 |
+
// Reset success message after 5 seconds
|
| 26 |
+
setTimeout(() => setIsSubmitted(false), 5000);
|
| 27 |
+
};
|
| 28 |
+
|
| 29 |
+
const handleChange = (e) => {
|
| 30 |
+
setFormData(prev => ({
|
| 31 |
+
...prev,
|
| 32 |
+
[e.target.name]: e.target.value
|
| 33 |
+
}));
|
| 34 |
+
};
|
| 35 |
+
|
| 36 |
+
const contactInfo = [
|
| 37 |
+
{
|
| 38 |
+
icon: Mail,
|
| 39 |
+
label: 'Email',
|
| 40 |
+
value: 'hello@johndoe.dev',
|
| 41 |
+
href: 'mailto:hello@johndoe.dev'
|
| 42 |
+
},
|
| 43 |
+
{
|
| 44 |
+
icon: Phone,
|
| 45 |
+
label: 'Phone',
|
| 46 |
+
value: '+1 (555) 123-4567',
|
| 47 |
+
href: 'tel:+15551234567'
|
| 48 |
+
},
|
| 49 |
+
{
|
| 50 |
+
icon: MapPin,
|
| 51 |
+
label: 'Location',
|
| 52 |
+
value: 'San Francisco, CA',
|
| 53 |
+
href: '#'
|
| 54 |
+
}
|
| 55 |
+
];
|
| 56 |
+
|
| 57 |
+
return (
|
| 58 |
+
<section id="contact" className="bg-white">
|
| 59 |
+
<div className="section-container">
|
| 60 |
+
<div className="text-center mb-12">
|
| 61 |
+
<h2 className="text-3xl sm:text-4xl font-bold text-gray-900 mb-4">Get In Touch</h2>
|
| 62 |
+
<p className="text-lg text-gray-600 max-w-2xl mx-auto">
|
| 63 |
+
Have a project in mind or want to collaborate? I'd love to hear from you!
|
| 64 |
+
</p>
|
| 65 |
+
<div className="w-20 h-1 bg-primary-500 mx-auto rounded-full mt-4"></div>
|
| 66 |
+
</div>
|
| 67 |
+
|
| 68 |
+
<div className="grid lg:grid-cols-2 gap-12 max-w-5xl mx-auto">
|
| 69 |
+
{/* Contact Info */}
|
| 70 |
+
<div className="space-y-8">
|
| 71 |
+
<div>
|
| 72 |
+
<h3 className="text-xl font-bold text-gray-900 mb-4">Let's talk about everything</h3>
|
| 73 |
+
<p className="text-gray-600 leading-relaxed">
|
| 74 |
+
Whether you have a question about my work, want to discuss a potential project,
|
| 75 |
+
or just want to say hi, feel free to reach out. I'm always open to discussing
|
| 76 |
+
new projects, creative ideas, or opportunities to be part of your vision.
|
| 77 |
+
</p>
|
| 78 |
+
</div>
|
| 79 |
+
|
| 80 |
+
<div className="space-y-4">
|
| 81 |
+
{contactInfo.map((info) => (
|
| 82 |
+
<a
|
| 83 |
+
key={info.label}
|
| 84 |
+
href={info.href}
|
| 85 |
+
className="flex items-center gap-4 p-4 rounded-xl bg-gray-50 hover:bg-primary-50 transition-colors group"
|
| 86 |
+
>
|
| 87 |
+
<div className="w-12 h-12 rounded-lg bg-primary-100 flex items-center justify-center group-hover:bg-primary-200 transition-colors">
|
| 88 |
+
<info.icon className="w-5 h-5 text-primary-600" />
|
| 89 |
+
</div>
|
| 90 |
+
<div>
|
| 91 |
+
<p className="text-sm text-gray-500">{info.label}</p>
|
| 92 |
+
<p className="font-medium text-gray-900">{info.value}</p>
|
| 93 |
+
</div>
|
| 94 |
+
</a>
|
| 95 |
+
))}
|
| 96 |
+
</div>
|
| 97 |
+
|
| 98 |
+
{/* Availability */}
|
| 99 |
+
<div className="p-4 rounded-xl bg-green-50 border border-green-100">
|
| 100 |
+
<div className="flex items-center gap-2 mb-2">
|
| 101 |
+
<span className="w-2 h-2 bg-green-500 rounded-full animate-pulse"></span>
|
| 102 |
+
<span className="text-sm font-medium text-green-700">Available for new projects</span>
|
| 103 |
+
</div>
|
| 104 |
+
<p className="text-sm text-green-600">
|
| 105 |
+
Currently accepting freelance work and full-time opportunities.
|
| 106 |
+
</p>
|
| 107 |
+
</div>
|
| 108 |
+
</div>
|
| 109 |
+
|
| 110 |
+
{/* Contact Form */}
|
| 111 |
+
<div className="bg-gray-50 rounded-2xl p-6 sm:p-8">
|
| 112 |
+
{isSubmitted ? (
|
| 113 |
+
<div className="flex flex-col items-center justify-center h-full py-12 text-center">
|
| 114 |
+
<CheckCircle className="w-16 h-16 text-green-500 mb-4" />
|
| 115 |
+
<h3 className="text-xl font-bold text-gray-900 mb-2">Message Sent!</h3>
|
| 116 |
+
<p className="text-gray-600">Thank you for reaching out. I'll get back to you soon.</p>
|
| 117 |
+
</div>
|
| 118 |
+
) : (
|
| 119 |
+
<form onSubmit={handleSubmit} className="space-y-5">
|
| 120 |
+
<div className="grid sm:grid-cols-2 gap-5">
|
| 121 |
+
<div>
|
| 122 |
+
<label htmlFor="name" className="block text-sm font-medium text-gray-700 mb-1.5">
|
| 123 |
+
Your Name
|
| 124 |
+
</label>
|
| 125 |
+
<input
|
| 126 |
+
type="text"
|
| 127 |
+
id="name"
|
| 128 |
+
name="name"
|
| 129 |
+
value={formData.name}
|
| 130 |
+
onChange={handleChange}
|
| 131 |
+
required
|
| 132 |
+
className="w-full px-4 py-2.5 rounded-lg border border-gray-300 focus:border-primary-500 focus:ring-2 focus:ring-primary-200 outline-none transition-all bg-white"
|
| 133 |
+
placeholder="John Smith"
|
| 134 |
+
/>
|
| 135 |
+
</div>
|
| 136 |
+
<div>
|
| 137 |
+
<label htmlFor="email" className="block text-sm font-medium text-gray-700 mb-1.5">
|
| 138 |
+
Email Address
|
| 139 |
+
</label>
|
| 140 |
+
<input
|
| 141 |
+
type="email"
|
| 142 |
+
id="email"
|
| 143 |
+
name="email"
|
| 144 |
+
value={formData.email}
|
| 145 |
+
onChange={handleChange}
|
| 146 |
+
required
|
| 147 |
+
className="w-full px-4 py-2.5 rounded-lg border border-gray-300 focus:border-primary-500 focus:ring-2 focus:ring-primary-200 outline-none transition-all bg-white"
|
| 148 |
+
placeholder="john@example.com"
|
| 149 |
+
/>
|
| 150 |
+
</div>
|
| 151 |
+
</div>
|
| 152 |
+
|
| 153 |
+
<div>
|
| 154 |
+
<label htmlFor="subject" className="block text-sm font-medium text-gray-700 mb-1.5">
|
| 155 |
+
Subject
|
| 156 |
+
</label>
|
| 157 |
+
<input
|
| 158 |
+
type="text"
|
| 159 |
+
id="subject"
|
| 160 |
+
name="subject"
|
| 161 |
+
value={formData.subject}
|
| 162 |
+
onChange={handleChange}
|
| 163 |
+
required
|
| 164 |
+
className="w-full px-4 py-2.5 rounded-lg border border-gray-300 focus:border-primary-500 focus:ring-2 focus:ring-primary-200 outline-none transition-all bg-white"
|
| 165 |
+
placeholder="Project Inquiry"
|
| 166 |
+
/>
|
| 167 |
+
</div>
|
| 168 |
+
|
| 169 |
+
<div>
|
| 170 |
+
<label htmlFor="message" className="block text-sm font-medium text-gray-700 mb-1.5">
|
| 171 |
+
Message
|
| 172 |
+
</label>
|
| 173 |
+
<textarea
|
| 174 |
+
id="message"
|
| 175 |
+
name="message"
|
| 176 |
+
value={formData.message}
|
| 177 |
+
onChange={handleChange}
|
| 178 |
+
required
|
| 179 |
+
rows={5}
|
| 180 |
+
className="w-full px-4 py-2.5 rounded-lg border border-gray-300 focus:border-primary-500 focus:ring-2 focus:ring-primary-200 outline-none transition-all bg-white resize-none"
|
| 181 |
+
placeholder="Tell me about your project..."
|
| 182 |
+
></textarea>
|
| 183 |
+
</div>
|
| 184 |
+
|
| 185 |
+
<button
|
| 186 |
+
type="submit"
|
| 187 |
+
disabled={isSubmitting}
|
| 188 |
+
className="w-full btn-primary disabled:opacity-50 disabled:cursor-not-allowed"
|
| 189 |
+
>
|
| 190 |
+
{isSubmitting ? (
|
| 191 |
+
<>
|
| 192 |
+
<Loader2 className="w-5 h-5 mr-2 animate-spin" />
|
| 193 |
+
Sending...
|
| 194 |
+
</>
|
| 195 |
+
) : (
|
| 196 |
+
<>
|
| 197 |
+
<Send className="w-5 h-5 mr-2" />
|
| 198 |
+
Send Message
|
| 199 |
+
</>
|
| 200 |
+
)}
|
| 201 |
+
</button>
|
| 202 |
+
</form>
|
| 203 |
+
)}
|
| 204 |
+
</div>
|
| 205 |
+
</div>
|
| 206 |
+
</div>
|
| 207 |
+
</section>
|
| 208 |
+
);
|
| 209 |
+
}
|