"use client" import { useState } from "react" import { Button } from "@/components/ui/button" import { Input } from "@/components/ui/input" import { Mail, Phone, MapPin, Send, ArrowRight, AlertCircle } from "lucide-react" export function Contact() { const [formData, setFormData] = useState({ name: "", email: "", message: "" }) const [isSubmitting, setIsSubmitting] = useState(false) const [isSubmitted, setIsSubmitted] = useState(false) const [error, setError] = useState("") const handleSubmit = async (e: React.FormEvent) => { e.preventDefault() setIsSubmitting(true) setError("") try { const response = await fetch('/api/send-email', { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify(formData), }) if (!response.ok) { const errorData = await response.json() throw new Error(errorData.error || 'Failed to send message') } setIsSubmitted(true) setFormData({ name: "", email: "", message: "" }) // Reset success message after 5 seconds setTimeout(() => setIsSubmitted(false), 5000) } catch (err) { const errorMessage = err instanceof Error ? err.message : 'An unexpected error occurred' setError(errorMessage) console.error('[v0] Form submission error:', err) } finally { setIsSubmitting(false) } } const contactInfo = [ { icon: Mail, label: "Email", value: "contact@cloudrite.co.nz", href: "mailto:contact@cloudrite.co.nz" }, { icon: Phone, label: "Phone", value: "021 107 7483", href: "tel:+64211077483" }, { icon: MapPin, label: "Location", value: "Auckland, New Zealand", href: "#" } ] return (
{/* Section Header */}
Get Started

Ready to Talk Tech?

Whether you need a new website, cloud hosting, or help with your I.T systems, we're here to help. Get in touch today.

{/* Contact Info */}

Contact Details

{contactInfo.map((item) => { const Icon = item.icon return (
{item.label}
{item.value}
) })}
{/* Hours */}

Business Hours

Hours By Appointment Only
24/7 Emergency Support Available
{/* Contact Form */}

Send Us a Message

{isSubmitted ? (

Message Sent!

Thanks for reaching out. We'll get back to you soon.

) : ( <> {error && (

{error}

)}
setFormData({ ...formData, name: e.target.value })} required className="bg-background border-border focus:border-primary transition-colors" />
setFormData({ ...formData, email: e.target.value })} required className="bg-background border-border focus:border-primary transition-colors" />