Contact form on the Contact page

React · React · beginner · modification

Visitors kept asking for a way to write to us without opening their mail app, so the Contact page gets a form. `src/contact/ContactForm.jsx` (new) collects name, email and message and sends them to [email protected] through MailRelay, with the visitor's address as reply-to so support can answer straight from their inbox. While sending, the form is disabled and a status line under it says what happened. `src/pages/ContactPage.jsx` renders the form under a new "Send us a message" heading; the mailto link and the address stay. `src/contact/ContactForm.test.jsx` (new) tests the sent and failed states.

Marketing site for Acme Scheduling: a React 18.3 single-page app built with Vite 5 (`vite build` writes static files to `dist/`), function components with hooks. Tests run with `npm test`: Vitest 2 with @testing-library/react 16 in jsdom. CI builds the site and deploys `dist/` together with the site's small API server, `server/index.js` (Express 4, CommonJS, Node 22; existing and unchanged), which serves `dist/` and mounts its routes under `/api` behind `express.json()` and a per-IP rate limiter. The API server's environment holds `MAILER_API_KEY`; its newsletter signup route (`server/routes/newsletter.js`, an Express router mounted with `app.use('/api', ...)`) already calls MailRelay with it. MailRelay's send endpoint is `POST https://api.mailrelay.example/v1/messages` with `Authorization: Bearer <key>` and a JSON body `{ from, to, reply_to, subject, text }` (plain text, no HTML); it answers 202 when it accepts a message and allows requests from any origin (CORS). `[email protected]` is a verified sender. The form classes `field`, `field-label` and `button` come from the global `src/styles.css` (unchanged). Spam protection for the form is out of scope for this PR.

Requirements

Files touched

Review this PR

React practice