-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathpage.tsx
More file actions
271 lines (253 loc) · 10.4 KB
/
page.tsx
File metadata and controls
271 lines (253 loc) · 10.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
"use client";
import { useState } from 'react';
import { motion } from 'framer-motion';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Textarea } from '@/components/ui/textarea';
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select';
import { Card, CardContent } from '@/components/ui/card';
import { MapPin, Mail, Github, Twitter, Linkedin } from 'lucide-react';
import { useToast } from '@/hooks/use-toast';
export default function Contact() {
const [formData, setFormData] = useState({
firstName: '',
lastName: '',
email: '',
subject: '',
message: '',
});
const [isSubmitting, setIsSubmitting] = useState(false);
const { toast } = useToast();
const handleSubmit = async (e: React.FormEvent) => {
e.preventDefault();
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 (!response.ok) {
throw new Error(data.error || 'Failed to send message');
}
toast({
title: "Message sent successfully!",
description: "We'll get back to you as soon as possible.",
});
// Reset form
setFormData({
firstName: '',
lastName: '',
email: '',
subject: '',
message: '',
});
} catch (error) {
console.error('Contact form error:', error);
toast({
title: "Failed to send message",
description: error instanceof Error ? error.message : "Please try again later or contact us directly.",
variant: "destructive",
});
} finally {
setIsSubmitting(false);
}
};
const handleInputChange = (field: string, value: string) => {
setFormData(prev => ({ ...prev, [field]: value }));
};
const contactInfo = [
{
icon: MapPin,
title: 'Headquarters',
content: 'Kozhiokode, CA\nIndia',
color: 'blue-accent',
},
{
icon: Mail,
title: 'Email',
content: 'codecompass2024@gmail.com,shadilrayyan2@gmail.com',
color: 'professional-blue',
},
{
icon: Github,
title: 'Open Source',
content: 'github.com/codecompasss\nContribute & collaborate',
color: 'blue-accent',
},
];
const socialLinks = [
{ icon: Github, href: 'https://github.com/CodeCompasss', color: 'blue-accent' },
// { icon: Twitter, href: 'https://twitter.com/codecompass', color: 'professional-blue' },
{ icon: Linkedin, href: 'https://linkedin.com/company/codecompass', color: 'blue-accent' },
];
return (
<div className="min-h-screen bg-white dark:bg-gray-800">
<section className="py-20">
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<motion.div
className="text-center mb-16"
initial={{ opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
>
<h1 className="text-4xl lg:text-5xl font-bold text-gray-900 dark:text-white mb-4">
Get In Touch
</h1>
<p className="text-xl text-gray-600 dark:text-gray-300 max-w-3xl mx-auto">
Have questions, suggestions, or want to contribute? We'd love to hear from you.
</p>
</motion.div>
<div className="grid lg:grid-cols-2 gap-16">
{/* Contact Information */}
<motion.div
className="space-y-8"
initial={{ opacity: 0, x: -30 }}
animate={{ opacity: 1, x: 0 }}
transition={{ delay: 0.2 }}
>
<div className="space-y-6">
{contactInfo.map(({ icon: Icon, title, content, color }, index) => (
<motion.div
key={title}
className="flex items-start space-x-4"
initial={{ opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
transition={{ delay: 0.3 + index * 0.1 }}
>
<div className={`w-12 h-12 bg-${color} rounded-xl flex items-center justify-center flex-shrink-0`}>
<Icon className="w-6 h-6 text-white" />
</div>
<div>
<h3 className="text-xl font-bold text-gray-900 dark:text-white mb-2">{title}</h3>
<p className="text-gray-600 dark:text-gray-300 whitespace-pre-line">{content}</p>
</div>
</motion.div>
))}
</div>
{/* Social Links */}
<motion.div
className="pt-8 border-t border-gray-200 dark:border-gray-700"
initial={{ opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
transition={{ delay: 0.6 }}
>
<h3 className="text-lg font-bold text-gray-900 dark:text-white mb-4">Follow Us</h3>
<div className="flex space-x-4">
{socialLinks.map(({ icon: Icon, href, color }, index) => (
<motion.a
key={href}
href={href}
target="_blank"
rel="noopener noreferrer"
className={`w-12 h-12 bg-gray-100 dark:bg-gray-700 rounded-xl flex items-center justify-center text-gray-600 dark:text-gray-300 hover:bg-${color} hover:text-white transition-colors`}
whileHover={{ scale: 1.1 }}
whileTap={{ scale: 0.9 }}
>
<Icon className="w-5 h-5" />
</motion.a>
))}
</div>
</motion.div>
</motion.div>
{/* Contact Form */}
<motion.div
initial={{ opacity: 0, x: 30 }}
animate={{ opacity: 1, x: 0 }}
transition={{ delay: 0.4 }}
>
<Card className="bg-gray-50 dark:bg-gray-700 border-0">
<CardContent className="p-8">
<h3 className="text-2xl font-bold text-gray-900 dark:text-white mb-6">Send us a message</h3>
<form onSubmit={handleSubmit} className="space-y-6">
<div className="grid md:grid-cols-2 gap-6">
<div>
<label htmlFor="firstName" className="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">
First Name
</label>
<Input
id="firstName"
type="text"
value={formData.firstName}
onChange={(e) => handleInputChange('firstName', e.target.value)}
className="bg-white dark:bg-gray-800"
required
/>
</div>
<div>
<label htmlFor="lastName" className="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">
Last Name
</label>
<Input
id="lastName"
type="text"
value={formData.lastName}
onChange={(e) => handleInputChange('lastName', e.target.value)}
className="bg-white dark:bg-gray-800"
required
/>
</div>
</div>
<div>
<label htmlFor="email" className="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">
Email
</label>
<Input
id="email"
type="email"
value={formData.email}
onChange={(e) => handleInputChange('email', e.target.value)}
className="bg-white dark:bg-gray-800"
required
/>
</div>
<div>
<label htmlFor="subject" className="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">
Subject
</label>
<Select value={formData.subject} onValueChange={(value) => handleInputChange('subject', value)}>
<SelectTrigger className="bg-white dark:bg-gray-800">
<SelectValue placeholder="Select a subject" />
</SelectTrigger>
<SelectContent>
<SelectItem value="general">General Inquiry</SelectItem>
<SelectItem value="support">Technical Support</SelectItem>
<SelectItem value="feature">Feature Request</SelectItem>
<SelectItem value="partnership">Partnership</SelectItem>
<SelectItem value="bug">Bug Report</SelectItem>
</SelectContent>
</Select>
</div>
<div>
<label htmlFor="message" className="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">
Message
</label>
<Textarea
id="message"
rows={5}
value={formData.message}
onChange={(e) => handleInputChange('message', e.target.value)}
className="bg-white dark:bg-gray-800 resize-vertical"
required
/>
</div>
<Button
type="submit"
size="lg"
className="w-full bg-blue-accent hover:bg-blue-600 text-white"
disabled={isSubmitting}
>
{isSubmitting ? 'Sending Message...' : 'Send Message'}
</Button>
</form>
</CardContent>
</Card>
</motion.div>
</div>
</div>
</section>
</div>
);
}