"use client"; import { useState } from "react"; import FadeIn from "@/components/FadeIn"; const subjects = [ "General Inquiry", "Billing", "Technical Support", "Hardware ID Reset", "Other", ]; export default function Contact() { const [form, setForm] = useState({ name: "", email: "", subject: subjects[0], message: "", }); const [status, setStatus] = useState<"idle" | "sending" | "sent" | "error">("idle"); const handleChange = ( e: React.ChangeEvent ) => { setForm({ ...form, [e.target.name]: e.target.value }); }; const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); setStatus("sending"); try { const res = await fetch("/api/contact", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(form), }); if (res.ok) { setStatus("sent"); setForm({ name: "", email: "", subject: subjects[0], message: "" }); } else { setStatus("error"); } } catch { setStatus("error"); } }; const inputStyle = { background: "#111111", border: "1px solid #222222", color: "#ffffff", borderRadius: "2px", padding: "10px 14px", fontSize: "14px", width: "100%", outline: "none", transition: "border-color 0.2s", }; return (

Contact

Get in Touch

{/* Contact info */} {/* Contact form */} {status === "sent" ? (

Message sent.

We'll get back to you as soon as possible.

) : (
(e.currentTarget.style.borderColor = "#ffffff")} onBlur={(e) => (e.currentTarget.style.borderColor = "#222222")} />
(e.currentTarget.style.borderColor = "#ffffff")} onBlur={(e) => (e.currentTarget.style.borderColor = "#222222")} />