add no-JS contact form and noscript banner
All checks were successful
deploy / deploy (push) Successful in 1m21s

Wire up the contact form with action/method/name attrs so it works
without JavaScript. Add ContactNotifier, ContactController, and a
noscript info banner in the shop root layout.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
jamey
2026-02-28 18:57:51 +00:00
parent af069c2bca
commit ca01f43d70
8 changed files with 256 additions and 8 deletions

View File

@@ -100,29 +100,31 @@ defmodule BerrypodWeb.ShopComponents.Content do
<div class="contact-form-spacer"></div>
<% end %>
<form class="contact-form">
<form action="/contact/send" method="post" phx-submit="send_contact" class="contact-form">
<input type="hidden" name="_csrf_token" value={Phoenix.Controller.get_csrf_token()} />
<div>
<label class="contact-form-label">Name</label>
<.shop_input type="text" placeholder="Your name" />
<.shop_input type="text" name="name" placeholder="Your name" required />
</div>
<div>
<label class="contact-form-label">Email</label>
<.shop_input type="email" placeholder="your@email.com" />
<.shop_input type="email" name="email" placeholder="your@email.com" required />
</div>
<div>
<label class="contact-form-label">Subject</label>
<.shop_input type="text" placeholder="How can I help?" />
<.shop_input type="text" name="subject" placeholder="How can I help?" />
</div>
<div>
<label class="contact-form-label">Message</label>
<.shop_textarea rows="5" placeholder="Your message..." />
<.shop_textarea name="message" rows="5" placeholder="Your message..." required />
</div>
<.shop_button type="submit" class="contact-form-submit">
Send Message
Send message
</.shop_button>
</form>
</.shop_card>