Files
AndreaSlopFotografie/web/src/components/home/ContactSection/ContactSection.tsx
T
SluijsensandClaude Opus 5.5 26a8bd9469 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>
2026-10-25 18:26:48 +01:00

95 lines
3.0 KiB
TypeScript

import { useEffect } from 'react';
import { useMediaQuery } from '@chakra-ui/react';
import { useNavigate } from '@tanstack/react-router';
import ContactPanel from '@/components/ContactPanel/ContactPanel';
import PageSection from '@/components/PageSection/PageSection';
import Reveal from '@/components/Reveal/Reveal';
import SectionHeading from '@/components/SectionHeading/SectionHeading';
import type {
EmailAddress,
HomeContent,
PricingPackage,
} from '@/content/types';
const TITLE_ID = 'contact-title';
type ContactSectionProps = {
content: HomeContent['contact'];
packages: PricingPackage[];
enabled: boolean;
email: EmailAddress;
replyTime: string;
// ?pakket= from a "Boek ..." link on a price card
pakket?: string;
};
// "Contact" on the homepage (design #contact): heading and lead, and the
// contact form, which sits far below the hero and so loads lazily. After a
// "Boek ..." click it tidies the URL and moves focus here (BR-PARAM-02,
// BR-FOCUS-01); the panel takes over the package itself.
export default function ContactSection({
content,
packages,
enabled,
email,
replyTime,
pakket,
}: ContactSectionProps) {
const navigate = useNavigate();
// Remove ?pakket= from the address bar (no extra history entry) and
// continue keyboard and screen reader users here. This navigation
// replaces the "Boek" click's before the router has scrolled for it, so
// it must ask the router to scroll to #contact itself.
const [reducedMotion] = useMediaQuery(
['(prefers-reduced-motion: reduce)'],
{ ssr: false },
);
useEffect(() => {
if (pakket === undefined) return;
void navigate({
to: '/',
search: {},
hash: 'contact',
replace: true,
resetScroll: false,
hashScrollIntoView: {
behavior: reducedMotion ? 'auto' : 'smooth',
block: 'start',
},
});
document.getElementById(TITLE_ID)?.focus({ preventScroll: true });
// Only when a new ?pakket= arrives, not when the motion setting changes
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [pakket, navigate]);
return (
<PageSection
labelledBy={TITLE_ID}
id="contact"
width="narrow"
data-testid="contact-section"
>
<Reveal>
<SectionHeading
id={TITLE_ID}
title={content.title}
lead={content.lead}
focusable
/>
</Reveal>
<Reveal>
<ContactPanel
idPrefix="home-contact"
packages={packages}
enabled={enabled}
email={email}
replyTime={replyTime}
pakket={pakket}
load="lazy"
/>
</Reveal>
</PageSection>
);
}