"use client" import { BuildingOffice2Icon, EnvelopeIcon, PhoneIcon } from "@heroicons/react/24/outline" import { FormEvent, use, useEffect, useState } from "react" export default function Contact() { const [isSent, setIsSent] = useState(false) const [isLoading, setIsLoading] = useState(false) const [error, setError] = useState(null) async function handleSubmit(event: FormEvent) { event.preventDefault() const form = event.target as HTMLFormElement const isValid = form.checkValidity() if (!isValid) { return } setIsLoading(true) fetch("/api/send", { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify({ firstName: form.firstName.value, lastName: form.lastName.value, email: form.email.value, message: form.message.value, phoneNumber: form.phoneNumber.value, }), }) .then((response) => { if (!response.ok) { throw new Error("Failed to send message") } form.reset() setIsSent(true) }) .catch((error) => { setError(error.message) }) .finally(() => { setIsLoading(false) }) } useEffect(() => { if(isSent) { const timeout = setTimeout(() => { setIsSent(false) }, 3000000) return () => clearTimeout(timeout) } }) return (
{isSent && (
setIsSent(false)} className="cursor-pointer absolute inset-0 flex items-center justify-center" >
Your message has been sent.
)}

Get in touch

Feel free to contact us for any questions or inquiries. we will get back to you as soon as possible.

Address
Kammenstraat 57
2000, Antwerpen
Telephone
+32496799751