Shares the Instagram block between pages
Moves InstagramGrid out of the homepage sections and gives it its own content module, so the portfolio can show the same block. The homepage renders exactly as before; the tiles keep reusing the intro and review photos, so each photo keeps one description. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+11
-2
@@ -1,11 +1,13 @@
|
||||
import { screen, within } from '@testing-library/react';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import homeContent from '@/content/homeContent';
|
||||
import { introPhotos } from '@/content/homeContent';
|
||||
import instagramContent from '@/content/instagramContent';
|
||||
import testimonials from '@/content/testimonials';
|
||||
import { axeResults } from '@/test/axe';
|
||||
import { renderWithProviders } from '@/test/renderWithProviders';
|
||||
import InstagramGrid from './InstagramGrid';
|
||||
|
||||
const instagram = homeContent.instagram;
|
||||
const instagram = instagramContent;
|
||||
const PROFILE = 'https://www.instagram.com/andreaslopfotografie/';
|
||||
|
||||
function expectExternal(link: HTMLElement) {
|
||||
@@ -50,6 +52,13 @@ describe('InstagramGrid', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('reuses the intro photos and then the review photos, so each photo keeps one description', () => {
|
||||
expect(instagram.photos).toEqual([
|
||||
...introPhotos,
|
||||
...testimonials.map((testimonial) => testimonial.image),
|
||||
]);
|
||||
});
|
||||
|
||||
it('still renders the heading and handle when there are no photos', async () => {
|
||||
await renderWithProviders(
|
||||
<InstagramGrid
|
||||
+3
-2
@@ -3,12 +3,12 @@ import DeferredImage from '@/components/DeferredImage/DeferredImage';
|
||||
import PageSection from '@/components/PageSection/PageSection';
|
||||
import Reveal from '@/components/Reveal/Reveal';
|
||||
import SectionHeading from '@/components/SectionHeading/SectionHeading';
|
||||
import type { HomeContent } from '@/content/types';
|
||||
import type { InstagramContent } from '@/content/types';
|
||||
|
||||
const TITLE_ID = 'instagram-title';
|
||||
|
||||
type InstagramGridProps = {
|
||||
content: HomeContent['instagram'];
|
||||
content: InstagramContent;
|
||||
// A checked https link (visibleSocials); without one the route leaves
|
||||
// the section out
|
||||
profileUrl: string;
|
||||
@@ -17,6 +17,7 @@ type InstagramGridProps = {
|
||||
// "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.
|
||||
// Shared by the homepage and the portfolio.
|
||||
export default function InstagramGrid({
|
||||
content,
|
||||
profileUrl,
|
||||
@@ -1,5 +1,4 @@
|
||||
import type { ContentImage, HomeContent } from './types';
|
||||
import testimonials from './testimonials';
|
||||
|
||||
// Images
|
||||
import intro1 from '../assets/home/intro-1.jpg';
|
||||
@@ -12,7 +11,7 @@ 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[] = [
|
||||
export const introPhotos: ContentImage[] = [
|
||||
{
|
||||
src: intro1,
|
||||
alt: 'Babyhandje in de hand van de moeder, op een gebreid dekentje',
|
||||
@@ -78,16 +77,6 @@ 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;
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
import { introPhotos } from './homeContent';
|
||||
import testimonials from './testimonials';
|
||||
import type { InstagramContent } from './types';
|
||||
|
||||
// The Instagram block on the homepage and the portfolio until the API
|
||||
// delivers the real feed. Reuses photos the site already has, so each photo
|
||||
// keeps one description and the homepage downloads nothing extra for them;
|
||||
// Andrea can swap them in the meantime.
|
||||
const instagramContent: InstagramContent = {
|
||||
title: 'Instagram',
|
||||
handle: '@andreaslopfotografie',
|
||||
photos: [
|
||||
...introPhotos,
|
||||
...testimonials.map((testimonial) => testimonial.image),
|
||||
],
|
||||
};
|
||||
|
||||
export default instagramContent;
|
||||
@@ -128,12 +128,14 @@ 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[];
|
||||
};
|
||||
}
|
||||
|
||||
// The Instagram block, shown on the homepage and the portfolio: a fixed
|
||||
// selection until the API delivers the real feed (FR-HP-10)
|
||||
export interface InstagramContent {
|
||||
title: string;
|
||||
handle: string;
|
||||
photos: ContentImage[];
|
||||
}
|
||||
|
||||
// Where a link goes: a route (a typo is a type error) and optionally an
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
import { createFileRoute } from '@tanstack/react-router';
|
||||
import Hero from '../components/Hero/Hero';
|
||||
import InstagramGrid from '../components/InstagramGrid/InstagramGrid';
|
||||
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';
|
||||
import heroContent from '../content/heroContent';
|
||||
import homeContent from '../content/homeContent';
|
||||
import instagramContent from '../content/instagramContent';
|
||||
import packages from '../content/packages';
|
||||
import testimonials from '../content/testimonials';
|
||||
import siteContent from '../content/siteContent';
|
||||
@@ -52,7 +53,7 @@ function Index() {
|
||||
/>
|
||||
{instagram && (
|
||||
<InstagramGrid
|
||||
content={homeContent.instagram}
|
||||
content={instagramContent}
|
||||
profileUrl={instagram.href}
|
||||
/>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user