-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcomponents_contact.tsx
76 lines (71 loc) · 2.35 KB
/
components_contact.tsx
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
'use client'
import { useState } from 'react'
import { Button } from '@/components/ui/button'
import { Input } from '@/components/ui/input'
import { Textarea } from '@/components/ui/textarea'
import { toast } from '@/components/ui/use-toast'
export default function Contact() {
const [formData, setFormData] = useState({
name: '',
email: '',
message: ''
})
const handleSubmit = (e: React.FormEvent) => {
e.preventDefault()
// Here you would typically send the form data to your backend
console.log('Form submitted:', formData)
toast({
title: "Message sent!",
description: "Thank you for your message. I'll get back to you soon.",
})
setFormData({ name: '', email: '', message: '' })
}
return (
<section className="py-16 bg-background" id="contact">
<div className="container px-4 md:px-6">
<div className="max-w-md mx-auto">
<h2 className="text-3xl font-bold tracking-tighter text-center mb-8">Contact Me</h2>
<form onSubmit={handleSubmit} className="space-y-4">
<div>
<label htmlFor="name" className="block text-sm font-medium mb-2">
Name
</label>
<Input
id="name"
value={formData.name}
onChange={(e) => setFormData({ ...formData, name: e.target.value })}
required
/>
</div>
<div>
<label htmlFor="email" className="block text-sm font-medium mb-2">
Email
</label>
<Input
id="email"
type="email"
value={formData.email}
onChange={(e) => setFormData({ ...formData, email: e.target.value })}
required
/>
</div>
<div>
<label htmlFor="message" className="block text-sm font-medium mb-2">
Message
</label>
<Textarea
id="message"
value={formData.message}
onChange={(e) => setFormData({ ...formData, message: e.target.value })}
required
/>
</div>
<Button type="submit" className="w-full">
Send Message
</Button>
</form>
</div>
</div>
</section>
)
}