Spaces:
Running

powerllm's picture
Upload components/Contact.js with huggingface_hub
9ddea7f verified
Raw History Blame Contribute Delete
6.22 kB
import { useState } from 'react'
export default function Contact() {
const [formData, setFormData] = useState({
name: '',
email: '',
message: ''
})
const [isSubmitting, setIsSubmitting] = useState(false)
const [submitted, setSubmitted] = useState(false)
const handleSubmit = async (e) => {
e.preventDefault()
setIsSubmitting(true)
// Simulate API call
await new Promise(resolve => setTimeout(resolve, 1000))
setIsSubmitting(false)
setSubmitted(true)
setFormData({ name: '', email: '', message: '' })
setTimeout(() => setSubmitted(false), 3000)
}
const handleChange = (e) => {
setFormData(prev => ({
...prev,
[e.target.name]: e.target.value
}))
}
return (
<section id="contact" className="py-20 px-4 bg-dark-800/50">
<div className="container mx-auto">
<div className="grid lg:grid-cols-2 gap-12">
<div>
<h2 className="text-4xl lg:text-5xl font-bold mb-4">
Get in <span className="gradient-text">Touch</span>
</h2>
<p className="text-xl text-dark-300 mb-8">
Ready to defy gravity with your next project? Let's talk about how we can help you achieve your goals.
</p>
<div className="space-y-6">
<div className="flex items-center space-x-4">
<div className="w-12 h-12 bg-primary-500/10 rounded-lg flex items-center justify-center text-primary-400">
<svg className="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z" />
</svg>
</div>
<div>
<p className="text-dark-400 text-sm">Email</p>
<p className="text-white">contact@ict-antigravity.com</p>
</div>
</div>
<div className="flex items-center space-x-4">
<div className="w-12 h-12 bg-primary-500/10 rounded-lg flex items-center justify-center text-primary-400">
<svg className="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z" />
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M15 11a3 3 0 11-6 0 3 3 0 016 0z" />
</svg>
</div>
<div>
<p className="text-dark-400 text-sm">Location</p>
<p className="text-white">San Francisco, CA</p>
</div>
</div>
</div>
</div>
<div className="card">
<form onSubmit={handleSubmit} className="space-y-6">
<div>
<label htmlFor="name" className="block text-sm font-medium text-dark-300 mb-2">Name</label>
<input
type="text"
id="name"
name="name"
value={formData.name}
onChange={handleChange}
required
className="w-full bg-dark-900 border border-dark-700 rounded-lg px-4 py-3 text-white placeholder-dark-500 focus:outline-none focus:border-primary-500 transition-colors"
placeholder="Your name"
/>
</div>
<div>
<label htmlFor="email" className="block text-sm font-medium text-dark-300 mb-2">Email</label>
<input
type="email"
id="email"
name="email"
value={formData.email}
onChange={handleChange}
required
className="w-full bg-dark-900 border border-dark-700 rounded-lg px-4 py-3 text-white placeholder-dark-500 focus:outline-none focus:border-primary-500 transition-colors"
placeholder="your@email.com"
/>
</div>
<div>
<label htmlFor="message" className="block text-sm font-medium text-dark-300 mb-2">Message</label>
<textarea
id="message"
name="message"
value={formData.message}
onChange={handleChange}
required
rows={4}
className="w-full bg-dark-900 border border-dark-700 rounded-lg px-4 py-3 text-white placeholder-dark-500 focus:outline-none focus:border-primary-500 transition-colors resize-none"
placeholder="Tell us about your project..."
/>
</div>
<button
type="submit"
disabled={isSubmitting}
className="btn-primary w-full flex items-center justify-center"
>
{isSubmitting ? (
<>
<svg className="animate-spin -ml-1 mr-3 h-5 w-5 text-white" fill="none" viewBox="0 0 24 24">
<circle className="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" strokeWidth="4"></circle>
<path className="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
</svg>
Sending...
</>
) : submitted ? (
<>
<svg className="w-5 h-5 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M5 13l4 4L19 7" />
</svg>
Message Sent!
</>
) : (
'Send Message'
)}
</button>
</form>
</div>
</div>
</div>
</section>
)
}