From c74fad179379260dcf46edeae22c1f04ee842508 Mon Sep 17 00:00:00 2001 From: Ashelyn Rose Date: Sat, 2 Dec 2023 16:29:03 -0700 Subject: Manual static image optimization --- app/contact/page.tsx | 76 ++-------------------------------------------------- 1 file changed, 2 insertions(+), 74 deletions(-) (limited to 'app/contact/page.tsx') diff --git a/app/contact/page.tsx b/app/contact/page.tsx index 1c144c2..6af8ad1 100644 --- a/app/contact/page.tsx +++ b/app/contact/page.tsx @@ -1,56 +1,7 @@ -'use client' -import { useState, useRef, FormEvent } from 'react' import InfoBar from "~/components/InfoBar/" - -import styles from '~/styles/form.module.css' - -const submitUrl = 'https://contact.tempest.dev/api/contact/me' +import ContactForm from "~/components/ContactForm" export default function Contact() { - const [submitting, setSubmitting] = useState(false) - const [status, setStatus] = useState('') - - const nameRef = useRef() - const emailRef = useRef() - const messageRef = useRef() - - const submit = async (ev: FormEvent) => { - ev.preventDefault() - - setStatus('') - - const name = nameRef.current.value - const email = emailRef.current.value - const message = messageRef.current.value - - if (!name) setStatus(s => s + ' Name required.') - if (!email) setStatus(s => s + ' Email required.') - if (!message) setStatus(s => s + ' Message required.') - - if (!name || !email || !message) - return - - setSubmitting(true) - - try { - - await fetch(submitUrl, { - method: 'post', - headers: { - 'content-type': 'application/json' - }, - body: JSON.stringify({ - name, email, message - }) - }) - - setStatus('Message sent successfully') - } catch { - setStatus('Error submitting message, please try again') - } finally { - setSubmitting(false) - } - } return ( <> @@ -61,30 +12,7 @@ export default function Contact() { Be nice. Please don't make us regret putting this here -
- - - - - - - -