Adds the Instagram section to the homepage

Shows the handle as a link to the profile and six square photos from edge
to edge (2, 3 or 6 per row), each linking to the profile in a new tab.
The photos are ones the page already loads, so the section adds no
downloads; the API will later fill it with the real feed. Without a valid
https link to Instagram the section is left out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-22 00:26:41 +02:00
co-authored by Claude Opus 5.5
parent f8905f5586
commit 52c1864a38
13 changed files with 511 additions and 36 deletions
@@ -5,7 +5,7 @@
- **Feature Slug**: homepage-sections
- **Project Type**: Brownfield
- **Start Date**: 2026-10-19T19:19:38Z
- **Current Stage**: CONSTRUCTION - Unit 5 Contact - Code Generation (awaiting approval)
- **Current Stage**: CONSTRUCTION - Unit 6 Instagram - Code Generation Part 1 (awaiting plan approval)
- **Branch**: feature/homepage-sections
## Workspace State
@@ -66,7 +66,7 @@
- [ ] NFR Requirements - SKIP
- [ ] NFR Design - SKIP
- [ ] Infrastructure Design - SKIP
- [ ] Code Generation - EXECUTE (per unit) — Unit 1 Lifestyle fotografie ✅, Unit 2 Over mij ✅ (desktop review deferred by user), Unit 3 Prijzen ✅, Unit 4 Lieve woorden ✅
- [ ] Code Generation - EXECUTE (per unit) — Unit 1 Lifestyle fotografie ✅, Unit 2 Over mij ✅ (desktop review deferred by user), Unit 3 Prijzen ✅, Unit 4 Lieve woorden ✅, Unit 5 Contact ✅
- [ ] Build and Test - EXECUTE
### 🟡 OPERATIONS PHASE
@@ -74,8 +74,8 @@
## Current Status
- **Lifecycle Phase**: CONSTRUCTION
- **Current Stage**: Unit 5 Contact — Code Generation complete, awaiting approval (pushed, test deploy running)
- **Next Stage**: Unit 5 Contact — Code Generation
- **Current Stage**: Unit 6 Instagram — Code Generation plan awaiting approval
- **Next Stage**: Unit 6 Instagram — Code Generation Part 2, then Build and Test
## Reverse Engineering Status
- [x] Reverse Engineering - Artifacts refreshed on 2026-10-19T19:19:38Z at commit 38c5c3e (approved 2026-10-19T19:31:00Z)
@@ -740,3 +740,111 @@ De foto mag nog iets kleiner? 75% van huidige groote maken is denk ik goed. Het
**Context**: CONSTRUCTION - Unit 5 bug fixes (awaiting approval of unit 5)
---
## Test Deploy Result (unit 5 incl. scroll fixes)
**Timestamp**: 2026-10-21T02:00:00Z
**User Input**: (none — CI run finished)
**AI Response**: "CI run 556 (0b00b78, deploy_test=true) completed: check, deploy-test and lighthouse success, deploy-production skipped. The Lighthouse failure of run 555 did not recur (runner issue). test.andreaslop.nl serves the Contact section."
**Context**: Test environment updated with unit 5 and the scroll fixes
---
## Unit 5 Contact — Change Request: Section Heading Size
**Timestamp**: 2026-10-21T20:10:48Z
**User Input**: "ik wil verder met d eopenstaande feature in aidlc. Ik had in ieder geval al een opmerking over de <h2>-tags. Die zijn wat groot. Kunnen die een grootte krijgen wat vertaald naar 30 pixels? Ze zijn nu in iede rgeval wat te groot en nu zijn ze computed 40px"
**AI Response**: "Resumed homepage-sections (unit 5 awaiting approval). The section h2s use textStyle sectionTitle (1.85rem / 2.125rem / 2.5rem = 40px at xl, from the design's --fs-h2). Changed it to a flat 1.875rem (30px) at every width; mobile was already 29.6px so a single size is simplest. Applies to all SectionHeading h2s on the homepage; footer h2s (eyebrow) and h1/h3 unchanged. Design static CSS left as is."
**Context**: CONSTRUCTION - Unit 5 change request (typography)
---
## Unit 5 Contact — Change Request: Price Card Heading Size
**Timestamp**: 2026-10-21T20:21:27Z
**User Input**: "de maten voor de prijskaarten mogen ietsje kleiner. Ze zijn nu bijna even groot als de h2's"
**AI Response**: "Price card h3 (package name) reduced from 1.75rem (28px) to 1.5rem (24px). The price itself stays 2.25rem (36px), larger than the 30px h2 — asked the owner whether that should shrink too."
**Context**: CONSTRUCTION - Unit 5 change request (typography)
---
## Unit 5 Contact — Change Request: Testimonial Quote Size
**Timestamp**: 2026-10-21T20:23:58Z
**User Input**: "De tekst van de lieve woorden. De blockquote is een beetje groot. zou je die ook wat kleiner kunnen maken?"
**AI Response**: "Testimonial blockquote reduced from clamp(1.35rem, 2.2vw, 1.75rem) (21.6–28px) to clamp(1.15rem, 1.7vw, 1.375rem) (18.4–22px). The carousel placeholder renders the longest slide itself, so its height follows automatically."
**Context**: CONSTRUCTION - Unit 5 change request (typography)
---
## Unit 5 Contact — Approval
**Timestamp**: 2026-10-21T20:36:20Z
**User Input**: "top het werkt. okee. dan kan je nu verder met de volgende unit"
**AI Response**: "Unit 5 approved (incl. the review typography changes: section h2 30px, price card h3 24px, testimonial quote 18.4–22px; price amount size question left open). Moving to Unit 6 Instagram."
**Context**: CONSTRUCTION - Unit 5 Code Generation approved
---
## Unit 6 Instagram — Code Generation Plan
**Timestamp**: 2026-10-21T20:36:20Z
**User Input**: (none — AI-initiated)
**AI Response**: "Created construction/plans/instagram-code-generation-plan.md (11 steps): content type and data reusing six already-bundled photos, HomeSection width='full' for the design's full-bleed grid, InstagramGrid (handle link, list of six square tiles 2/3/6 columns, accessible names alt + hint, hover/focus with reduced motion), route renders it only with a valid https Instagram link via visibleSocials, tests, pnpm check, LAYOUT.md check, summary, commit (typography changes in a separate commit first). Prompt: approve plan or request changes."
**Context**: CONSTRUCTION - Unit 6 Code Generation Part 1 (awaiting plan approval)
---
## Unit 6 Instagram — Plan Approval
**Timestamp**: 2026-10-21T20:40:08Z
**User Input**: "approve plan"
**AI Response**: "Plan approved. Starting Code Generation Part 2 (commit at the end, not pushed)."
**Context**: CONSTRUCTION - Unit 6 Code Generation Part 2 (start)
---
## Unit 6 Instagram — Code Generation (Lighthouse gate pending)
**Timestamp**: 2026-10-21T21:01:47Z
**User Input**: (none — AI-initiated)
**AI Response**: "Steps 1–7, 9, 10 done. pnpm check: lint, format, 244 tests, build, audits green; Lighthouse home mobile 0.73 (budget 0.8), /contact 0.84 in the first run. Benchmark index was halved (1889 vs ~4200). A/B with the unit 5 build (git stash of web/, 3 runs each): both 0.68–0.84, TBT 190–600 ms, no difference; machine under load (game and a Vite dev server). Visual check in headless Chrome: 6/3/2 columns, full-bleed, h2 30px, no extra image requests. Not committed; asked the owner whether to rerun the gate on a quiet machine first."
**Context**: CONSTRUCTION - Unit 6 Code Generation, Step 8 Lighthouse pending
---
## Unit 6 Instagram — Lighthouse Rerun
**Timestamp**: 2026-10-21T22:26:33Z
**User Input**: "ik heb rocket league afgesloten. Ik zie in de browser bij performance ook ineens maar een score van 44 en 51 op desktop. De rest is in beide gevallen 100. Op mobiel is dat 35 en 33 terwijl de andere onderdelen 100 zijn."
**AI Response**: "The browser scores come from the Vite dev server (port 5173): measured it at desktop 0.55 / mobile 0.36 with 137 unbundled requests, so not representative. Rebuilt and reran pnpm lighthouse on the production build: passed — home mobile 0.81 (TBT 230 ms), desktop 1.0, other pages 0.93–0.94 / 1.0, a11y/BP/SEO 1.0. Step 8 ticked; committing as in the approved plan (Step 11), not pushed."
**Context**: CONSTRUCTION - Unit 6 Code Generation, Step 8 complete
---
@@ -0,0 +1,25 @@
# Code Summary — Unit 6: Instagram
Plan: [instagram-code-generation-plan.md](../../plans/instagram-code-generation-plan.md)
## Files
| File | Change |
|---|---|
| `web/src/content/types.ts` | `HomeContent.instagram: { title; handle; photos: ContentImage[] }` |
| `web/src/content/homeContent.ts` | Intro photos moved to a shared `introPhotos` constant; `instagram` content reuses them plus the two review photos (`testimonials`), so one photo keeps one alt text and the section adds no image downloads |
| `web/src/components/HomeSection/HomeSection.tsx` + test | `width="full"`: no `Container`, for edge-to-edge content |
| `web/src/components/SectionHeading/SectionHeading.tsx` | `lead` accepts a `ReactNode` (the handle link) |
| `web/src/components/home/InstagramGrid/InstagramGrid.tsx` + test | New section: centred heading with the handle as external link, full-bleed list of square tiles (2 / 3 from `md` / 6 from `xl`, 2px gap), each an external link named by the photo's alt plus "(Instagram, opent in nieuw tabblad)"; hover and keyboard focus zoom 1.06 and fade to 85%, fade only under reduced motion; focused tile lifted above its neighbours so the ring is not covered |
| `web/src/routes/index.tsx` | Renders `InstagramGrid` last, only when `visibleSocials` yields an Instagram link (https) |
| `web/src/app.test.tsx` | Instagram added to the page-order check; section absent when the link is missing or not https (`siteContent.socials` overridable through a hoisted mock) |
`LAYOUT.md` already lists Instagram as the last homepage block: unchanged.
## Verification
- Lint, Prettier, typecheck/build, dependency audit: ✅
- Tests: 244 passed (53 files); new: 3 InstagramGrid, 1 HomeSection, 3 app (order + two absent cases)
- Visual (headless Chrome, preview build): 6 columns at 1440px, 3 at 1024px, 2 at 390px; grid as wide as the viewport; h2 30px; the page requests the same 15 images as before (no new ones)
- Lighthouse (`pnpm lighthouse`, production build): ✅ homepage mobile 0.81 (TBT 230 ms, LCP 3.8 s), desktop 1.0; other pages mobile 0.93–0.94, desktop 1.0; accessibility, best practices and SEO 1.0 everywhere.
- A first run failed (home mobile 0.73, /contact 0.84) while the machine was under load (a game and a Vite dev server). Back-to-back runs of the unit 5 build and this build both scattered between 0.68 and 0.84, with no difference between them; with the game closed the gate passed. Scores measured in the browser against the Vite dev server (desktop 0.55, mobile 0.36, 137 unbundled requests) say nothing about the production site.
@@ -0,0 +1,58 @@
# Code Generation Plan — Unit 6: Instagram
**This plan is the single source of truth for Code Generation of unit 6.**
## Unit context
- **Requirements**: FR-HP-10, FR-HP-11 (reveal, reused), FR-HP-12, NFR-HP-01/02/03/05/06; security NFR on external links
- **Design**: [unit-of-work.md](../../inception/application-design/unit-of-work.md) unit 6; [component-methods.md](../../inception/application-design/component-methods.md) (`HomeContent.instagram`, `InstagramGrid` props); design reference `design/andreaslop-static/index.html` (Instagram section: `.section--tight`, centred `.section__head`, handle as `.lead` with `.link-underline`) and `style.css` §17 (`.instagram__grid`, `.instagram__tile`) plus the 1100px (3 columns) and 680px (2 columns) breakpoints
- **Depends on**: unit 1 (`HomeSection` incl. `spacing="tight"`, `SectionHeading`, `Reveal`, `DeferredImage`), unit 2 (`underline` link variant), the existing `visibleSocials` helper (BR-SOC-01) and the footer's external-link pattern
- **Functional Design**: skipped (presentational). **PBT-01**: N/A, no new business logic; picking the Instagram link reuses `visibleSocials`, which already has tests. Example-based tests (PBT-10).
- Conventions as in the earlier units: English comments and test names, Dutch visitor text, `data-testid`, theme tokens, deferred images.
## Decisions taken in this plan
- **Full-bleed grid**: in the design the tile grid sits outside `.container` and runs from edge to edge, while the heading stays in the content column. `HomeSection` gets a `width="full"` option (no `Container`), and `InstagramGrid` puts its heading in its own `Container`.
- **Images, no new files**: the six tiles reuse photos that the homepage already bundles and loads (`intro-1` to `intro-4`, `review-newbornshoot`, `review-trouwshoot`). The browser fetches them only once, so the section adds no image bytes. They show as squares (`object-fit: cover`). Andrea can replace them later, and the API feature replaces them with the real feed.
- **Accessible names**: each tile is a link to the profile. Its name is the photo's alt text plus a hidden "(Instagram, opent in nieuw tabblad)". Six links with the same name "Instagramfoto", as in the design, would tell a screen reader user nothing.
- **Hidden without a valid link**: the route picks the Instagram entry from `visibleSocials(siteContent.socials)`. Without one, the section is not rendered at all, because the handle and every tile would have nowhere to link to.
- **Hover**: as in the design, the photo scales to 1.06 and drops to 85% opacity on hover and on keyboard focus. Under reduced motion it changes opacity only, without scaling. Focus gets the theme's visible focus ring.
## Steps
### Content
- [x] **Step 1** — `content/types.ts`: extend `HomeContent` with `instagram: { title: string; handle: string; photos: ContentImage[] }`.
- [x] **Step 2** — `content/homeContent.ts`: title "Instagram", handle "@andreaslopfotografie", the six reused photos with their existing alt texts (shared constants where the intro gallery already defines them, so the texts do not drift apart).
### Shared pieces
- [x] **Step 3** — `HomeSection`: `width` gains `'full'` (children rendered without `Container`). Test for the full-width variant.
### The section
- [x] **Step 4** — `components/home/InstagramGrid/InstagramGrid.tsx`: `HomeSection` with `spacing="tight"`, `width="full"`; a `Container` with a `Reveal` around the centred `SectionHeading` (h2 "Instagram") and below it the handle as a `lead`-sized external link (`underline` variant, `target="_blank"`, `rel="noopener noreferrer"`, hidden "(opent in nieuw tabblad)"), `data-testid="instagram-handle-link"`. Below it a `Reveal` with the grid: plain `ul`/`li` (a list of six), 2 columns, 3 from `md`, 6 from `xl` (the design's 680/1100px steps mapped onto the theme breakpoints), 2px gap; each tile is an external link (`data-testid="instagram-tile-{n}"`) with a square `DeferredImage` on a `paper.deep` background, hover and focus as decided above.
- [x] **Step 5** — `components/home/InstagramGrid/InstagramGrid.test.tsx`: region named by the h2; handle link with href, `target`, `rel` and the hidden hint; six tiles, each linking to the profile with `target`/`rel` and a name made of the alt text plus the hint; zero photos still renders heading and handle; axe clean.
- [x] **Step 6** — `routes/index.tsx`: find the Instagram link in `visibleSocials(siteContent.socials)` and render `InstagramGrid` after `ContactSection` only when it exists.
- [x] **Step 7** — `app.test.tsx`: add "Instagram" (named by its h2) as the last section in the page-order check; a test that the section is absent when there is no valid Instagram link (mocked `siteContent`, as the earlier unit tests do for the contact form).
### Verification and wrap-up
- [x] **Step 8** — `pnpm check` (incl. Lighthouse); fix and rerun until green. Visual check at desktop width (6 columns, full-bleed), at 1024px (3 columns) and at an emulated 390px phone (2 columns); confirm in the network panel that no extra image requests appear.
- [x] **Step 9** — `LAYOUT.md`: check the homepage diagram against the finished section order (following `.ai/layout-conventions.md`), update it only if it differs.
- [x] **Step 10** — `construction/instagram/code/code-summary.md`.
- [ ] **Step 11** — Commit on `feature/homepage-sections` ("Adds the Instagram section to the homepage" + attribution), together with the typography changes from the unit 5 review in a separate commit before it. Not pushed unless the owner asks.
## Requirement traceability
| Requirement | Steps |
|---|---|
| FR-HP-10 | 1, 2, 4–7 |
| FR-HP-11 | 4 |
| FR-HP-12 | 2 |
| NFR-HP-01 (accessibility) | 4, 5, 8 |
| NFR-HP-02 (design fidelity) | 3, 4, 8 |
| NFR-HP-03 (tests) | 3, 5, 7, 8 |
| NFR-HP-05 (performance) | 2, 4, 8 |
| NFR-HP-06 (API-ready content) | 1, 2 |
| External links (security NFR) | 4–6 |
## Extension compliance (planned)
- **Security**: no new dependencies or external resources (no embed, no third-party script, no request to Instagram); external links use `noopener noreferrer`; only `https:` links are rendered (BR-SOC-01 via `visibleSocials`). Other rules N/A.
- **PBT**: PBT-01 N/A (no new logic); PBT-10 example-based tests present.
### Note on Step 8
- Everything except the Lighthouse performance gate is green. The homepage mobile score scattered between 0.68 and 0.84 for both the unit 5 build and this build in back-to-back runs (machine under load), so the gate was rerun on a quiet machine: passed (home mobile 0.81, desktop 1.0).
+44
View File
@@ -13,6 +13,7 @@ import { FakeIntersectionObserver } from './test/fakeIntersectionObserver';
import { routeTree } from './routeTree.gen';
import sitePages from './sitePages';
import { axeResults } from './test/axe';
import type { SocialLink } from './content/types';
import system from './theme';
// Laat PageIntro op verzoek crashen, om de foutpagina binnen de shell te testen
@@ -30,6 +31,24 @@ vi.mock('./components/PageIntro/PageIntro', async (importOriginal) => {
};
});
// Lets a test replace the social links, e.g. without a valid Instagram link
const socials = vi.hoisted(() => ({
override: null as SocialLink[] | null,
}));
vi.mock('./content/siteContent', async (importOriginal) => {
const original = (
await importOriginal<typeof import('./content/siteContent')>()
).default;
return {
default: {
...original,
get socials() {
return socials.override ?? original.socials;
},
},
};
});
// The homepage's review carousel (Zag) needs an IntersectionObserver and
// Element.scrollTo, which jsdom lacks
beforeEach(() => {
@@ -39,6 +58,7 @@ beforeEach(() => {
afterEach(() => {
crash.enabled = false;
socials.override = null;
vi.unstubAllGlobals();
FakeIntersectionObserver.reset();
// @ts-expect-error -- jsdom has no Element.scrollTo of its own
@@ -148,6 +168,7 @@ describe('homepage', () => {
screen.getByRole('region', { name: 'Prijzen' }),
screen.getByRole('region', { name: 'Lieve woorden' }),
screen.getByRole('region', { name: 'Contact' }),
screen.getByRole('region', { name: 'Instagram' }),
];
let previous: Element = hero;
@@ -161,6 +182,29 @@ describe('homepage', () => {
expect(screen.getAllByRole('heading', { level: 1 })).toHaveLength(1);
expect(await axeResults(container)).toHaveNoViolations();
});
it.each([
['missing', []],
[
'not https',
[
{
platform: 'instagram',
href: 'http://www.instagram.com/andreaslopfotografie/',
},
],
],
] satisfies [string, SocialLink[]][])(
'leaves out the Instagram section when its link is %s',
async (_, links) => {
socials.override = links;
await renderApp('/');
await screen.findByRole('region', { name: 'Contact' });
expect(
screen.queryByRole('region', { name: 'Instagram' }),
).toBeNull();
},
);
});
describe('homepage ?pakket=', () => {
@@ -34,4 +34,18 @@ describe('HomeSection', () => {
'contact',
);
});
it('leaves out the content column at full width', async () => {
await renderWithProviders(
<HomeSection labelledBy="insta-title" width="full">
<h2 id="insta-title" data-testid="child">
Instagram
</h2>
</HomeSection>,
);
// The heading is a direct child of the section, not of a Container
expect(screen.getByTestId('child').parentElement).toBe(
screen.getByRole('region', { name: 'Instagram' }),
);
});
});
+12 -4
View File
@@ -6,7 +6,9 @@ type HomeSectionProps = {
labelledBy: string;
id?: string;
tone?: 'paper' | 'alt';
width?: 'default' | 'narrow';
// full: no content column, for edge-to-edge content; the section then
// places its own Container around what should stay in the column
width?: 'default' | 'narrow' | 'full';
spacing?: 'default' | 'tight';
'data-testid'?: string;
children: ReactNode;
@@ -34,9 +36,15 @@ export default function HomeSection({
scrollMarginTop={id ? 'header' : undefined}
py={spacing === 'tight' ? 'sectionYTight' : 'sectionY'}
>
<Container maxW={width === 'narrow' ? 'contentNarrow' : 'content'}>
{children}
</Container>
{width === 'full' ? (
children
) : (
<Container
maxW={width === 'narrow' ? 'contentNarrow' : 'content'}
>
{children}
</Container>
)}
</Box>
);
}
@@ -1,3 +1,4 @@
import type { ReactNode } from 'react';
import { Box, Heading, Text } from '@chakra-ui/react';
type SectionHeadingProps = {
@@ -5,7 +6,8 @@ type SectionHeadingProps = {
id: string;
title: string;
eyebrow?: string;
lead?: string;
// Text, or e.g. a link as in the Instagram section
lead?: ReactNode;
align?: 'center' | 'start';
// compact: little space below, for a heading above running text
spacing?: 'default' | 'compact';
@@ -0,0 +1,66 @@
import { screen, within } from '@testing-library/react';
import { describe, expect, it } from 'vitest';
import homeContent from '@/content/homeContent';
import { axeResults } from '@/test/axe';
import { renderWithProviders } from '@/test/renderWithProviders';
import InstagramGrid from './InstagramGrid';
const instagram = homeContent.instagram;
const PROFILE = 'https://www.instagram.com/andreaslopfotografie/';
function expectExternal(link: HTMLElement) {
expect(link).toHaveAttribute('href', PROFILE);
expect(link).toHaveAttribute('target', '_blank');
expect(link).toHaveAttribute('rel', 'noopener noreferrer');
}
describe('InstagramGrid', () => {
it('shows the heading and the handle as a link to the profile', async () => {
const { container } = await renderWithProviders(
<InstagramGrid content={instagram} profileUrl={PROFILE} />,
);
const section = screen.getByRole('region', { name: 'Instagram' });
expect(
within(section).getByRole('heading', { level: 2 }),
).toHaveTextContent('Instagram');
const handle = screen.getByTestId('instagram-handle-link');
expect(handle).toHaveAccessibleName(
'@andreaslopfotografie (opent in nieuw tabblad)',
);
expectExternal(handle);
expect(await axeResults(container)).toHaveNoViolations();
});
it('shows six photo tiles in order, each linking to the profile', async () => {
await renderWithProviders(
<InstagramGrid content={instagram} profileUrl={PROFILE} />,
);
const items = within(screen.getByRole('list')).getAllByRole('listitem');
expect(items).toHaveLength(6);
instagram.photos.forEach((photo, index) => {
const tile = screen.getByTestId(`instagram-tile-${index + 1}`);
expect(items[index]).toContainElement(tile);
expectExternal(tile);
expect(tile).toHaveAccessibleName(
`${photo.alt} (Instagram, opent in nieuw tabblad)`,
);
const image = within(tile).getByRole('img');
expect(image).toHaveAttribute('loading', 'lazy');
expect(image).toHaveAttribute('width', String(photo.width));
});
});
it('still renders the heading and handle when there are no photos', async () => {
await renderWithProviders(
<InstagramGrid
content={{ ...instagram, photos: [] }}
profileUrl={PROFILE}
/>,
);
expect(
screen.getByRole('heading', { name: 'Instagram' }),
).toBeInTheDocument();
expect(screen.getByTestId('instagram-handle-link')).toBeInTheDocument();
expect(screen.queryAllByRole('img')).toHaveLength(0);
});
});
@@ -0,0 +1,117 @@
import { Box, chakra, Container, Link, VisuallyHidden } from '@chakra-ui/react';
import DeferredImage from '@/components/DeferredImage/DeferredImage';
import HomeSection from '@/components/HomeSection/HomeSection';
import Reveal from '@/components/Reveal/Reveal';
import SectionHeading from '@/components/SectionHeading/SectionHeading';
import type { HomeContent } from '@/content/types';
const TITLE_ID = 'instagram-title';
type InstagramGridProps = {
content: HomeContent['instagram'];
// A checked https link (visibleSocials); without one the route leaves
// the section out
profileUrl: string;
};
// "Instagram" (design .instagram): the handle as a link to the profile and
// a row of square photos running from edge to edge, each linking to the
// profile too. A fixed selection until the API delivers the real feed.
export default function InstagramGrid({
content,
profileUrl,
}: InstagramGridProps) {
return (
<HomeSection
labelledBy={TITLE_ID}
spacing="tight"
width="full"
data-testid="instagram-grid"
>
<Container maxW="content">
<Reveal>
<SectionHeading
id={TITLE_ID}
title={content.title}
lead={
<Link
variant="underline"
href={profileUrl}
target="_blank"
rel="noopener noreferrer"
data-testid="instagram-handle-link"
>
{/* Space outside the hidden text, or it drops
out of the announced name */}
{content.handle}{' '}
<VisuallyHidden>
(opent in nieuw tabblad)
</VisuallyHidden>
</Link>
}
/>
</Reveal>
</Container>
<Reveal>
{/* The design's 680px and 1100px steps on the theme breakpoints */}
<chakra.ul
listStyleType="none"
display="grid"
gridTemplateColumns={{
base: 'repeat(2, 1fr)',
md: 'repeat(3, 1fr)',
xl: 'repeat(6, 1fr)',
}}
gap="2px"
>
{content.photos.map((photo, i) => (
// The same photo may appear twice in a feed
<chakra.li key={`${i}-${photo.src}`}>
<chakra.a
href={profileUrl}
target="_blank"
rel="noopener noreferrer"
data-testid={`instagram-tile-${i + 1}`}
display="block"
position="relative"
// Keeps the focus ring above the neighbouring
// tiles, which sit only 2px away
_focusVisible={{ zIndex: 1 }}
className="group"
>
<Box overflow="hidden" bg="paper.deep">
<DeferredImage
image={photo}
w="100%"
aspectRatio="1 / 1"
objectFit="cover"
transitionProperty="transform, opacity"
transitionDuration="interaction"
transitionTimingFunction="smooth"
_groupHover={{
transform: 'scale(1.06)',
opacity: 0.85,
}}
_groupFocusVisible={{
transform: 'scale(1.06)',
opacity: 0.85,
}}
// Only the fade, no zoom
_motionReduce={{
transform: 'none !important',
}}
/>
</Box>
{/* The photo's alt names the link; this says
where it goes */}{' '}
<VisuallyHidden>
(Instagram, opent in nieuw tabblad)
</VisuallyHidden>
</chakra.a>
</chakra.li>
))}
</chakra.ul>
</Reveal>
</HomeSection>
);
}
+42 -27
View File
@@ -1,4 +1,5 @@
import type { HomeContent } from './types';
import type { ContentImage, HomeContent } from './types';
import testimonials from './testimonials';
// Images
import intro1 from '../assets/home/intro-1.jpg';
@@ -9,38 +10,42 @@ import andrea from '../assets/home/andrea.jpg';
import deco1 from '../assets/home/deco-1.png';
import deco2 from '../assets/home/deco-2.png';
// Shared by the intro gallery and the Instagram tiles, so one photo keeps
// one description
const introPhotos: ContentImage[] = [
{
src: intro1,
alt: 'Babyhandje in de hand van de moeder, op een gebreid dekentje',
width: 800,
height: 1200,
},
{
src: intro2,
alt: 'Moeder drukt haar pasgeboren baby in een gebreid truitje tegen zich aan',
width: 800,
height: 1200,
},
{
src: intro3,
alt: 'Zwangere vrouw op blote voeten in het zand bij zonsondergang',
width: 800,
height: 1200,
},
{
src: intro4,
alt: 'Aanstaande vader omarmt zijn zwangere partner in de duinen',
width: 800,
height: 1200,
},
];
// Static content of the homepage sections until the CMS API exists; the API
// will then deliver this object.
const homeContent: HomeContent = {
intro: {
title: 'Lifestyle fotografie',
lead: 'Jouw favoriete momenten, vastgelegd op een natuurlijke en ongedwongen manier.',
photos: [
{
src: intro1,
alt: 'Babyhandje in de hand van de moeder, op een gebreid dekentje',
width: 800,
height: 1200,
},
{
src: intro2,
alt: 'Moeder drukt haar pasgeboren baby in een gebreid truitje tegen zich aan',
width: 800,
height: 1200,
},
{
src: intro3,
alt: 'Zwangere vrouw op blote voeten in het zand bij zonsondergang',
width: 800,
height: 1200,
},
{
src: intro4,
alt: 'Aanstaande vader omarmt zijn zwangere partner in de duinen',
width: 800,
height: 1200,
},
],
photos: introPhotos,
},
about: {
eyebrow: 'Over mij',
@@ -73,6 +78,16 @@ const homeContent: HomeContent = {
title: 'Contact',
lead: 'Wil je meer informatie ontvangen? Neem gerust contact met mij op.',
},
instagram: {
title: 'Instagram',
handle: '@andreaslopfotografie',
// Photos the page already loads, so the tiles cost no extra download;
// Andrea can swap them until the API delivers the real feed
photos: [
...introPhotos,
...testimonials.map((testimonial) => testimonial.image),
],
},
};
export default homeContent;
+6
View File
@@ -80,6 +80,12 @@ export interface HomeContent {
title: string;
lead: string;
};
// A fixed selection until the API delivers the real feed (FR-HP-10)
instagram: {
title: string;
handle: string;
photos: ContentImage[];
};
}
export interface HeroSlide {
+12
View File
@@ -2,6 +2,7 @@ import { createFileRoute } from '@tanstack/react-router';
import Hero from '../components/Hero/Hero';
import AboutBlock from '../components/home/AboutBlock/AboutBlock';
import ContactSection from '../components/home/ContactSection/ContactSection';
import InstagramGrid from '../components/home/InstagramGrid/InstagramGrid';
import Pricing from '../components/home/Pricing/Pricing';
import Testimonials from '../components/home/Testimonials/Testimonials';
import IntroGallery from '../components/home/IntroGallery/IntroGallery';
@@ -10,6 +11,7 @@ import homeContent from '../content/homeContent';
import packages from '../content/packages';
import testimonials from '../content/testimonials';
import siteContent from '../content/siteContent';
import { visibleSocials } from '../lib/visibleSocials';
import { pageHead } from '../seo';
// ?pakket= from a "Boek" link on a price card. Only text is kept; whether it
@@ -26,6 +28,10 @@ export const Route = createFileRoute('/')({
// The homepage: the hero, then the sections in the order of LAYOUT.md
function Index() {
const { pakket } = Route.useSearch();
// Without a valid https link the tiles would lead nowhere: no section
const instagram = visibleSocials(siteContent.socials).find(
(social) => social.platform === 'instagram',
);
return (
<>
<Hero content={heroContent} socials={siteContent.socials} />
@@ -43,6 +49,12 @@ function Index() {
email={siteContent.email}
pakket={pakket}
/>
{instagram && (
<InstagramGrid
content={homeContent.instagram}
profileUrl={instagram.href}
/>
)}
</>
);
}