2023-08-02 15:16:52 +02:00
|
|
|
"use client"
|
|
|
|
|
import { BuildingOffice2Icon, EnvelopeIcon, PhoneIcon } from "@heroicons/react/24/outline"
|
2023-08-25 15:28:06 +02:00
|
|
|
import { FormEvent, useState } from "react"
|
2023-08-02 15:16:52 +02:00
|
|
|
|
|
|
|
|
export default function Contact() {
|
2023-08-25 15:28:06 +02:00
|
|
|
const [isSent, setIsSent] = useState(false)
|
|
|
|
|
const [isLoading, setIsLoading] = useState(false)
|
|
|
|
|
|
|
|
|
|
async function handleSubmit(event: FormEvent<HTMLFormElement>) {
|
2023-08-02 15:16:52 +02:00
|
|
|
event.preventDefault()
|
2023-08-04 11:12:10 +02:00
|
|
|
const form = event.target as HTMLFormElement
|
2023-08-25 15:28:06 +02:00
|
|
|
const isValid = form.checkValidity()
|
|
|
|
|
|
|
|
|
|
if (!isValid) {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setIsLoading(true)
|
2023-08-02 15:16:52 +02:00
|
|
|
|
2023-08-25 15:28:06 +02:00
|
|
|
await fetch("/api/send", {
|
2023-08-02 15:16:52 +02:00
|
|
|
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,
|
|
|
|
|
}),
|
|
|
|
|
})
|
2023-08-25 15:28:06 +02:00
|
|
|
|
|
|
|
|
form.reset()
|
|
|
|
|
setIsSent(true)
|
|
|
|
|
setIsLoading(false)
|
2023-08-02 15:16:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div className="relative isolate bg-primary-50">
|
2023-08-25 15:28:06 +02:00
|
|
|
{isSent && (
|
|
|
|
|
<div
|
|
|
|
|
onClick={() => setIsSent(false)}
|
|
|
|
|
className="cursor-pointer bg-primary-700 py-4 text-center text-primary-800 lg:px-4"
|
|
|
|
|
>
|
|
|
|
|
<div className="flex items-center bg-primary-50 p-2 leading-none lg:inline-flex lg:rounded-full" role="alert">
|
|
|
|
|
<span className="mr-3 flex rounded-full bg-primary-50 px-2 py-1 text-xs font-bold uppercase">Sent</span>
|
|
|
|
|
<span className="mr-2 flex-auto text-left font-semibold">Your message has been sent.</span>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
2023-08-02 15:16:52 +02:00
|
|
|
<div className="mx-auto grid max-w-7xl grid-cols-1 lg:grid-cols-2">
|
|
|
|
|
<div className="relative px-6 pb-20 pt-24 sm:pt-32 lg:static lg:px-8 lg:py-48">
|
|
|
|
|
<div className="mx-auto max-w-xl lg:mx-0 lg:max-w-lg">
|
|
|
|
|
<h2 className="text-3xl font-bold tracking-tight text-primary-800">Get in touch</h2>
|
|
|
|
|
<p className="mt-6 text-lg leading-8 text-primary-800">
|
2023-08-04 11:12:10 +02:00
|
|
|
Feel free to contact me for any questions or inquiries. we will get back to you as soon as possible.
|
2023-08-02 15:16:52 +02:00
|
|
|
</p>
|
|
|
|
|
<dl className="mt-10 space-y-4 text-base leading-7 text-primary-800">
|
|
|
|
|
<div className="flex gap-x-4">
|
|
|
|
|
<dt className="flex-none">
|
|
|
|
|
<span className="sr-only">Address</span>
|
|
|
|
|
<BuildingOffice2Icon className="h-7 w-6 text-primary-800" aria-hidden="true" />
|
|
|
|
|
</dt>
|
|
|
|
|
<dd>
|
2023-08-25 13:15:58 +02:00
|
|
|
Kammenstraat 57
|
2023-08-02 15:16:52 +02:00
|
|
|
<br />
|
2023-08-25 13:15:58 +02:00
|
|
|
2000, Antwerpen
|
2023-08-02 15:16:52 +02:00
|
|
|
</dd>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="flex gap-x-4">
|
|
|
|
|
<dt className="flex-none">
|
|
|
|
|
<span className="sr-only">Telephone</span>
|
|
|
|
|
<PhoneIcon className="h-7 w-6 text-primary-800" aria-hidden="true" />
|
|
|
|
|
</dt>
|
|
|
|
|
<dd>
|
2023-08-25 14:04:07 +02:00
|
|
|
<a className="hover:text-white" href="tel:+32496799751">
|
2023-08-02 15:16:52 +02:00
|
|
|
+32496799751
|
|
|
|
|
</a>
|
|
|
|
|
</dd>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="flex gap-x-4">
|
|
|
|
|
<dt className="flex-none">
|
|
|
|
|
<span className="sr-only">Email</span>
|
|
|
|
|
<EnvelopeIcon className="h-7 w-6 text-primary-800" aria-hidden="true" />
|
|
|
|
|
</dt>
|
|
|
|
|
<dd>
|
2023-08-25 14:52:29 +02:00
|
|
|
<a className="hover:text-white" href="mailto:sam.antonis@isacon.be">
|
2023-08-02 15:16:52 +02:00
|
|
|
sam.antonis@isacon.be
|
|
|
|
|
</a>
|
|
|
|
|
</dd>
|
|
|
|
|
</div>
|
|
|
|
|
</dl>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<form onSubmit={handleSubmit} className="px-6 pb-24 pt-20 sm:pb-32 lg:px-8 lg:py-48">
|
|
|
|
|
<div className="mx-auto max-w-xl lg:mr-0 lg:max-w-lg">
|
|
|
|
|
<div className="grid grid-cols-1 gap-x-8 gap-y-6 sm:grid-cols-2">
|
|
|
|
|
<div>
|
|
|
|
|
<label htmlFor="firstName" className="block text-sm font-semibold leading-6 text-primary-800">
|
|
|
|
|
First name
|
|
|
|
|
</label>
|
|
|
|
|
<div className="mt-2.5">
|
|
|
|
|
<input
|
2023-08-25 15:28:06 +02:00
|
|
|
required
|
2023-08-02 15:16:52 +02:00
|
|
|
type="text"
|
|
|
|
|
name="firstName"
|
|
|
|
|
id="firstName"
|
|
|
|
|
autoComplete="given-name"
|
|
|
|
|
className="block w-full rounded-md border-0 bg-white/5 px-3.5 py-2 text-primary-800 shadow-sm ring-1 ring-inset ring-white/10 focus:ring-2 focus:ring-inset focus:ring-primary-500 sm:text-sm sm:leading-6"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
|
<label htmlFor="lastName" className="block text-sm font-semibold leading-6 text-primary-800">
|
|
|
|
|
Last name
|
|
|
|
|
</label>
|
|
|
|
|
<div className="mt-2.5">
|
|
|
|
|
<input
|
2023-08-25 15:28:06 +02:00
|
|
|
required
|
2023-08-02 15:16:52 +02:00
|
|
|
type="text"
|
|
|
|
|
name="lastName"
|
|
|
|
|
id="lastName"
|
|
|
|
|
autoComplete="family-name"
|
|
|
|
|
className="block w-full rounded-md border-0 bg-white/5 px-3.5 py-2 text-primary-800 shadow-sm ring-1 ring-inset ring-white/10 focus:ring-2 focus:ring-inset focus:ring-primary-500 sm:text-sm sm:leading-6"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="sm:col-span-2">
|
|
|
|
|
<label htmlFor="email" className="block text-sm font-semibold leading-6 text-primary-800">
|
|
|
|
|
Email
|
|
|
|
|
</label>
|
|
|
|
|
<div className="mt-2.5">
|
|
|
|
|
<input
|
2023-08-25 15:28:06 +02:00
|
|
|
required
|
2023-08-02 15:16:52 +02:00
|
|
|
type="email"
|
|
|
|
|
name="email"
|
|
|
|
|
id="email"
|
|
|
|
|
autoComplete="email"
|
|
|
|
|
className="block w-full rounded-md border-0 bg-white/5 px-3.5 py-2 text-primary-800 shadow-sm ring-1 ring-inset ring-white/10 focus:ring-2 focus:ring-inset focus:ring-primary-500 sm:text-sm sm:leading-6"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="sm:col-span-2">
|
|
|
|
|
<label htmlFor="phoneNumber" className="block text-sm font-semibold leading-6 text-primary-800">
|
|
|
|
|
Phone number
|
|
|
|
|
</label>
|
|
|
|
|
<div className="mt-2.5">
|
|
|
|
|
<input
|
2023-08-25 15:28:06 +02:00
|
|
|
required
|
2023-08-02 15:16:52 +02:00
|
|
|
type="tel"
|
|
|
|
|
name="phoneNumber"
|
|
|
|
|
id="phoneNumber"
|
|
|
|
|
autoComplete="tel"
|
|
|
|
|
className="block w-full rounded-md border-0 bg-white/5 px-3.5 py-2 text-primary-800 shadow-sm ring-1 ring-inset ring-white/10 focus:ring-2 focus:ring-inset focus:ring-primary-500 sm:text-sm sm:leading-6"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="sm:col-span-2">
|
|
|
|
|
<label htmlFor="message" className="block text-sm font-semibold leading-6 text-primary-800">
|
|
|
|
|
Message
|
|
|
|
|
</label>
|
|
|
|
|
<div className="mt-2.5">
|
|
|
|
|
<textarea
|
2023-08-25 15:28:06 +02:00
|
|
|
required
|
2023-08-02 15:16:52 +02:00
|
|
|
name="message"
|
|
|
|
|
id="message"
|
|
|
|
|
rows={4}
|
|
|
|
|
className="block w-full rounded-md border-0 bg-white/5 px-3.5 py-2 text-primary-800 shadow-sm ring-1 ring-inset ring-white/10 focus:ring-2 focus:ring-inset focus:ring-primary-500 sm:text-sm sm:leading-6"
|
|
|
|
|
defaultValue={""}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="mt-8 flex justify-end">
|
|
|
|
|
<button
|
2023-08-25 15:28:06 +02:00
|
|
|
disabled={isLoading}
|
2023-08-02 15:16:52 +02:00
|
|
|
type="submit"
|
|
|
|
|
className="rounded-md bg-primary-800 px-3.5 py-2.5 text-center text-sm font-semibold text-primary-50 shadow-sm hover:bg-primary-600 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-500"
|
|
|
|
|
>
|
|
|
|
|
Send message
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</form>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
}
|