Functional design, code generation plan and summary of the contact page, the updated LAYOUT.md diagram and the extended link requirement. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3.3 KiB
3.3 KiB
Frontend Components — Unit 3: Contact page
Hierarchy
graph TD
Route["routes/contact.tsx"] --> Intro["PageIntro: eyebrow, h1, intro"]
Route --> Section["PageSection flushTop, labelled by the form heading"]
Section --> NarrowCard["ContactDetails with portrait (below lg)"]
Section --> Grid["Grid: one column, two from lg"]
Grid --> FormCol["Form column: hidden h2 + ContactPanel eager"]
Grid --> Aside["contact/ContactAside (from lg)"]
Aside --> Photo["picture: photo from lg only"]
Aside --> WideCard["ContactDetails (overlapping the photo)"]
classDef page fill:#2196F3,stroke:#0d47a1,color:#000;
classDef shared fill:#4CAF50,stroke:#2e7d32,color:#000;
classDef small fill:#e2e8f0,stroke:#4a5568,color:#000;
class Route,Section,Grid,FormCol page;
class Intro,NarrowCard,WideCard,Aside shared;
class Photo small;
Text alternative: the contact route renders PageIntro and one PageSection; inside it the narrow-screen card, then a grid with the form column and, from lg, ContactAside with the photo and the wide-screen card.
routes/contact.tsx
validateSearchkeepspakketwhen it is a string;headper the business logic model.- Effect: when
pakketis defined,navigate({ to: '/contact', search: {}, replace: true, resetScroll: false }). - Renders
PageIntrowithwithReplyTime(head.intro, replyTime), then the section. - Section:
PageSection labelledBy="contact-form-title" spacing="flushTop" data-testid="contact-page". - Narrow card: wrapper
display={{ base: 'block', lg: 'none' }},ContactDetails titleId="contact-details-narrow" portrait={portrait} data-testid="contact-details-narrow", margin below it. - Grid:
templateColumns={{ base: '1fr', lg: '3fr 2fr' }}, gap asMediaText(clamp(2rem, 6vw, 5.5rem)),alignItems="start". - Form column:
VisuallyHiddenh2withid="contact-form-title", thenContactPanel idPrefix="contact" load="eager"with the route'spakket. - Test ids:
contact-page,contact-details-narrow,contact-details-wide,contact-aside,contact-aside-photo.
components/contact/ContactAside
- Props:
image: ContentImage,children: ReactNode(the card). - Wrapper
display={{ base: 'none', lg: 'block' }},position="relative", padding below the photo for the overlapping card. chakra.picturewith<source media="(min-width: 64em)" srcSet={image.src}>and animgwith a 1×1 transparentdata:GIF assrc,alt={image.alt}, intrinsicwidth/height,fetchPriority="high",decoding="async", aspect ratio 4:5,objectFit="cover", backgroundpaper.deepwhile loading.- Card position: absolutely placed over the bottom of the photo with side insets (
left/right≈ 1.5rem,bottom0), as in the mockup.
Responsive behaviour
| Width | What shows |
|---|---|
| < 480 px | intro, card with portrait, form (name and e-mail stacked) |
| 480–1023 px | same, name and e-mail side by side |
| ≥ 1024 px | intro, form left, photo with card right |
Accessibility
- Reading and tab order: intro → (narrow card) → form → (wide card); hidden variants are
display: none. - The visually hidden form heading names the section; the cards each have a labelled list.
- Photo alt text describes the photo; portrait decorative.