Shares the contact form, contact card and privacy line
ContactPanel holds the coming-soon gate, the shoot options, the package chosen via ?pakket= and the form, which loads as its own chunk either when it comes near the screen (homepage) or right away (contact page). ContactDetails shows the ways to reach Andrea as a card with icons. A privacy line now sits under the form and under the coming-soon notice, and the reply time in the thank-you comes from the site content. Instagram is listed before Facebook, so the footer and hero follow. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -26,6 +26,7 @@ const renderForm = (
|
||||
options={options}
|
||||
mailSubject="Vraag via andreaslop.nl"
|
||||
email={siteContent.email}
|
||||
replyTime="1-2 werkdagen"
|
||||
submit={vi.fn().mockResolvedValue(undefined)}
|
||||
{...props}
|
||||
/>,
|
||||
@@ -117,6 +118,24 @@ describe('ContactForm', () => {
|
||||
expect(screen.queryByTestId('contact-form')).toBeNull();
|
||||
});
|
||||
|
||||
it('takes the reply time for the thank-you from the content', async () => {
|
||||
await renderForm({ replyTime: '3 werkdagen' });
|
||||
fillIn();
|
||||
send();
|
||||
expect(
|
||||
await screen.findByTestId('contact-form-sent'),
|
||||
).toHaveTextContent('Ik reageer binnen 3 werkdagen.');
|
||||
});
|
||||
|
||||
it('shows the privacy line under the submit button', async () => {
|
||||
await renderForm();
|
||||
const form = screen.getByTestId('contact-form');
|
||||
expect(form).toContainElement(screen.getByTestId('privacy-note'));
|
||||
expect(
|
||||
screen.getByRole('link', { name: 'privacyverklaring' }),
|
||||
).toHaveAttribute('href', '/privacyverklaring');
|
||||
});
|
||||
|
||||
it('keeps the input and offers the mail link when sending fails', async () => {
|
||||
await renderForm({ submit: vi.fn().mockRejectedValue(new Error('x')) });
|
||||
fillIn();
|
||||
@@ -194,6 +213,7 @@ describe('ContactForm', () => {
|
||||
preselect={preselect}
|
||||
mailSubject="Vraag via andreaslop.nl"
|
||||
email={siteContent.email}
|
||||
replyTime="1-2 werkdagen"
|
||||
/>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -12,6 +12,7 @@ import {
|
||||
Textarea,
|
||||
useRecipe,
|
||||
} from '@chakra-ui/react';
|
||||
import PrivacyNote from '@/components/PrivacyNote/PrivacyNote';
|
||||
import { submitContactForm } from '@/contact/submitContactForm';
|
||||
import {
|
||||
CONTACT_LIMITS,
|
||||
@@ -39,12 +40,11 @@ type ContactFormProps = {
|
||||
preselect?: { shoot: string; key: number };
|
||||
mailSubject: string;
|
||||
email: EmailAddress;
|
||||
// How soon Andrea answers, e.g. '1-2 werkdagen' (siteContent)
|
||||
replyTime: string;
|
||||
submit?: (payload: ContactPayload) => Promise<void>;
|
||||
};
|
||||
|
||||
const SENT_MESSAGE =
|
||||
'Bedankt voor je bericht! Ik reageer binnen 1-2 werkdagen.';
|
||||
|
||||
// The contact form (design .form): name and e-mail, the shoot, the question,
|
||||
// and the browser-side anti-spam. Its behaviour is the pure
|
||||
// contactFormReducer; this component wires it to the fields.
|
||||
@@ -54,6 +54,7 @@ export default function ContactForm({
|
||||
preselect,
|
||||
mailSubject,
|
||||
email,
|
||||
replyTime,
|
||||
submit = submitContactForm,
|
||||
}: ContactFormProps) {
|
||||
const reduce = (
|
||||
@@ -106,7 +107,7 @@ export default function ContactForm({
|
||||
borderStartColor="accent"
|
||||
bg="paper.alt"
|
||||
>
|
||||
{SENT_MESSAGE}
|
||||
{`Bedankt voor je bericht! Ik reageer binnen ${replyTime}.`}
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
@@ -298,6 +299,7 @@ export default function ContactForm({
|
||||
>
|
||||
{disabled ? 'Versturen…' : '(Aan)vraag versturen'}
|
||||
</chakra.button>
|
||||
<PrivacyNote />
|
||||
</Stack>
|
||||
</chakra.form>
|
||||
);
|
||||
|
||||
@@ -44,7 +44,21 @@ describe('ContactFormGate', () => {
|
||||
expect(screen.getByTestId('contact-gate-notice')).toHaveTextContent(
|
||||
'Het contactformulier komt binnenkort.',
|
||||
);
|
||||
expect(screen.queryByRole('link')).toBeNull();
|
||||
// Only the privacy link is left; no mail link without an address
|
||||
expect(
|
||||
screen.getAllByRole('link').map((link) => link.textContent),
|
||||
).toEqual(['privacyverklaring']);
|
||||
});
|
||||
|
||||
it('shows the privacy line under the notice, outside the inert form', async () => {
|
||||
await renderGate(false);
|
||||
const notice = screen.getByTestId('contact-gate-notice');
|
||||
const note = screen.getByTestId('privacy-note');
|
||||
expect(notice).toContainElement(note);
|
||||
expect(note.closest('[inert]')).toBeNull();
|
||||
expect(
|
||||
screen.getByRole('link', { name: 'privacyverklaring' }),
|
||||
).toHaveAttribute('href', '/privacyverklaring');
|
||||
});
|
||||
|
||||
it('shows just the form when switched on', async () => {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import type { ReactNode } from 'react';
|
||||
import { Box, chakra, Link, Text, useRecipe } from '@chakra-ui/react';
|
||||
import Eyebrow from '@/components/Eyebrow/Eyebrow';
|
||||
import PrivacyNote from '@/components/PrivacyNote/PrivacyNote';
|
||||
import type { EmailAddress } from '@/content/types';
|
||||
import { emailAddress } from '@/lib/emailAddress';
|
||||
import { mailtoLink } from '@/lib/mailLink';
|
||||
@@ -68,6 +69,8 @@ export default function ContactFormGate({
|
||||
Stuur een e-mail
|
||||
</chakra.a>
|
||||
)}
|
||||
{/* Readable now, while the form's own line is inert (BR-PR-03) */}
|
||||
<PrivacyNote mt={6} />
|
||||
</Box>
|
||||
</Box>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user