da71153a73
deploy / deploy (push) Successful in 4s
Adds top nav links to Books/Authors/Submissions stub pages, and Contact/Privacy/Terms pages modeled on reground-site's structure. Contact form posts to the already-provisioned eec-twosquirrelspress backend. Styling implements the press's brand palette and font choices. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
61 lines
2.2 KiB
HTML
61 lines
2.2 KiB
HTML
{{ define "main" }}
|
|
<h1>Get in touch</h1>
|
|
<p style="opacity:0.85;">Tell us a bit about what's on your mind — we read every message ourselves.</p>
|
|
|
|
<form id="contact-form" style="margin-top:2rem;">
|
|
<label for="name">Name</label>
|
|
<input type="text" id="name" name="name" required autocomplete="name">
|
|
|
|
<label for="email">Email</label>
|
|
<input type="email" id="email" name="email" required autocomplete="email">
|
|
|
|
<label for="message">Message</label>
|
|
<textarea id="message" name="message" rows="6" required></textarea>
|
|
|
|
<div class="field-honeypot" aria-hidden="true">
|
|
<label for="website">Leave this field empty</label>
|
|
<input type="text" id="website" name="website" tabindex="-1" autocomplete="off">
|
|
</div>
|
|
|
|
<button type="submit" class="btn">Send message</button>
|
|
</form>
|
|
<p id="contact-status" role="status" style="margin-top:1rem;"></p>
|
|
|
|
<script>
|
|
(function () {
|
|
var form = document.getElementById("contact-form");
|
|
var status = document.getElementById("contact-status");
|
|
form.addEventListener("submit", function (e) {
|
|
e.preventDefault();
|
|
var payload = {
|
|
name: form.name.value,
|
|
email: form.email.value,
|
|
message: form.message.value,
|
|
website: form.website.value
|
|
};
|
|
var submitBtn = form.querySelector("button[type=submit]");
|
|
submitBtn.disabled = true;
|
|
status.textContent = "Sending…";
|
|
fetch("{{ .Site.Params.eec_base_url }}/contact", {
|
|
method: "POST",
|
|
headers: { "Content-Type": "application/json" },
|
|
body: JSON.stringify(payload)
|
|
}).then(function (res) {
|
|
submitBtn.disabled = false;
|
|
if (res.ok) {
|
|
form.reset();
|
|
status.textContent = "Thanks — we'll get back to you soon.";
|
|
return;
|
|
}
|
|
return res.text().then(function (msg) {
|
|
status.textContent = msg || "Something went wrong sending that. Try again, or email hello@twosquirrelspress.com directly.";
|
|
});
|
|
}).catch(function () {
|
|
submitBtn.disabled = false;
|
|
status.textContent = "Something went wrong sending that. Try again, or email hello@twosquirrelspress.com directly.";
|
|
});
|
|
});
|
|
})();
|
|
</script>
|
|
{{ end }}
|