Add contact form and thank-you redirect flow
This commit is contained in:
+78
-1
@@ -1,5 +1,5 @@
|
||||
import { useState, useEffect } from 'react'
|
||||
import { Routes, Route } from 'react-router-dom'
|
||||
import { Routes, Route, useNavigate } from 'react-router-dom'
|
||||
import AdminPage from './AdminPage'
|
||||
import './App.css'
|
||||
|
||||
@@ -13,6 +13,8 @@ const YOUTUBE_URL = 'https://www.youtube.com/@blackzebraem5558'
|
||||
const AMAZON_MUSIC_URL =
|
||||
'https://music.amazon.com/podcasts/202322bf-db86-4e7d-9a6b-4db7cbccbccf/verse-by-verse-with-nate'
|
||||
const FACEBOOK_URL = 'https://facebook.com/versebyversewithnate'
|
||||
const CONTACT_FORM_ACTION = 'https://formsubmit.co/vbvwithnate@outlook.com'
|
||||
const CONTACT_FORM_NEXT = '/thanks'
|
||||
|
||||
function FacebookIcon() {
|
||||
return (
|
||||
@@ -113,6 +115,7 @@ function LandingPage({ content }: { content: SiteContent }) {
|
||||
<a href="#listen">Listen</a>
|
||||
<a href="#about">About</a>
|
||||
<a href="#series">Series</a>
|
||||
<a href="#contact">Contact</a>
|
||||
<a
|
||||
href={SPOTIFY_SHOW_URL}
|
||||
target="_blank"
|
||||
@@ -321,6 +324,39 @@ function LandingPage({ content }: { content: SiteContent }) {
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* ── CONTACT ── */}
|
||||
<section className="section-contact" id="contact" aria-label="Contact form">
|
||||
<div className="section-inner contact-inner">
|
||||
<div className="contact-copy">
|
||||
<p className="eyebrow">Get in Touch</p>
|
||||
<h2 className="section-heading">
|
||||
<span className="ornament">✦</span> Contact Nate <span className="ornament">✦</span>
|
||||
</h2>
|
||||
<p>
|
||||
Have a question, testimony, or topic request? Send a message and we will get back to you.
|
||||
</p>
|
||||
</div>
|
||||
<form className="contact-form" action={CONTACT_FORM_ACTION} method="POST">
|
||||
<input type="hidden" name="_subject" value="New message from Verse by Verse website" />
|
||||
<input type="hidden" name="_next" value={CONTACT_FORM_NEXT} />
|
||||
<input type="text" name="_honey" className="contact-honeypot" tabIndex={-1} autoComplete="off" />
|
||||
<label>
|
||||
Name
|
||||
<input type="text" name="name" required autoComplete="name" />
|
||||
</label>
|
||||
<label>
|
||||
Email
|
||||
<input type="email" name="email" required autoComplete="email" />
|
||||
</label>
|
||||
<label>
|
||||
Message
|
||||
<textarea name="message" rows={6} required />
|
||||
</label>
|
||||
<button type="submit" className="btn-primary">Send Message</button>
|
||||
</form>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* ── CUSTOM RESOURCES ── */}
|
||||
{(content.customLinks ?? []).filter(l => l.placement === 'resources').length > 0 && (
|
||||
<section className="section-resources" aria-label="More resources">
|
||||
@@ -355,6 +391,10 @@ function LandingPage({ content }: { content: SiteContent }) {
|
||||
<p className="footer-ornament">✦ ✦ ✦</p>
|
||||
<p className="footer-title">Verse by Verse with Nate</p>
|
||||
<p className="footer-sub">A Journey Through Scripture</p>
|
||||
<p className="footer-contact">
|
||||
Contact:{' '}
|
||||
<a href="mailto:vbvwithnate@outlook.com">vbvwithnate@outlook.com</a>
|
||||
</p>
|
||||
<nav className="footer-links" aria-label="Footer links">
|
||||
<a href={SPOTIFY_SHOW_URL} target="_blank" rel="noreferrer">Spotify</a>
|
||||
<span aria-hidden="true">·</span>
|
||||
@@ -378,6 +418,42 @@ function LandingPage({ content }: { content: SiteContent }) {
|
||||
)
|
||||
}
|
||||
|
||||
function ThankYouPage() {
|
||||
const navigate = useNavigate()
|
||||
const [secondsLeft, setSecondsLeft] = useState(15)
|
||||
|
||||
useEffect(() => {
|
||||
const timeoutId = window.setTimeout(() => {
|
||||
navigate('/')
|
||||
}, 15000)
|
||||
|
||||
const intervalId = window.setInterval(() => {
|
||||
setSecondsLeft(s => (s > 0 ? s - 1 : 0))
|
||||
}, 1000)
|
||||
|
||||
return () => {
|
||||
window.clearTimeout(timeoutId)
|
||||
window.clearInterval(intervalId)
|
||||
}
|
||||
}, [navigate])
|
||||
|
||||
return (
|
||||
<main className="thanks-page" aria-label="Thank you">
|
||||
<div className="thanks-card">
|
||||
<p className="eyebrow">Message Received</p>
|
||||
<h1>Thank You</h1>
|
||||
<p>
|
||||
Your message was sent successfully. We appreciate you reaching out and will get back to you soon.
|
||||
</p>
|
||||
<p className="thanks-countdown">Returning to the main site in {secondsLeft} seconds...</p>
|
||||
<button type="button" className="btn-primary" onClick={() => navigate('/')}>
|
||||
Go Back Now
|
||||
</button>
|
||||
</div>
|
||||
</main>
|
||||
)
|
||||
}
|
||||
|
||||
export default function App() {
|
||||
const [content, setContent] = useState<SiteContent>(DEFAULTS)
|
||||
|
||||
@@ -395,6 +471,7 @@ export default function App() {
|
||||
return (
|
||||
<Routes>
|
||||
<Route path="/" element={<LandingPage content={content} />} />
|
||||
<Route path="/thanks" element={<ThankYouPage />} />
|
||||
<Route path="/admin" element={<AdminPage content={content} onSave={setContent} />} />
|
||||
</Routes>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user