Completes the front-end shell with footer, status pages and SEO
Adds the footer, back-to-top button, skip link, placeholder routes, 404 and error pages inside the shell, plus per-page SEO from a single page registry (canonical URLs, Open Graph image, JSON-LD, generated sitemap.xml and robots.txt). Theme tokens and recipes replace repeated styling, the hero loads only the active and neighbouring slides, and the e-mail address is joined in the browser to keep it out of the HTML and bundle. Adds Vitest with property-based (fast-check) and axe tests, ESLint, security headers for dev and preview, Lighthouse CI and a `pnpm check` script that runs all quality gates. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,20 +1,35 @@
|
||||
import { useState } from 'react';
|
||||
import { Box, chakra, Container, Heading, Image } from '@chakra-ui/react';
|
||||
import LinkButton from '../LinkButton';
|
||||
import HeroArrows from './HeroArrows';
|
||||
import HeroSocials from './HeroSocials';
|
||||
import useHeroSlider from './useHeroSlider';
|
||||
import type { HeroContent } from './types';
|
||||
import type { HeroContent, SocialLink } from '@/content/types';
|
||||
import { slidesToLoad } from '@/lib/slidesToLoad';
|
||||
|
||||
const SLIDE_DURATION = '6s';
|
||||
|
||||
type HeroProps = {
|
||||
content: HeroContent;
|
||||
socials: SocialLink[];
|
||||
};
|
||||
|
||||
export default function Hero({ content }: HeroProps) {
|
||||
const { title, tagline, cta, slides, socials } = content;
|
||||
export default function Hero({ content, socials }: HeroProps) {
|
||||
const { title, tagline, cta, slides } = content;
|
||||
const { active, reducedMotion, autoplay, paused, next, prev, handlers } =
|
||||
useHeroSlider(slides.length);
|
||||
// De slides liggen op elkaar in beeld, dus loading="lazy" stelt niets uit.
|
||||
// Eerst alleen de actieve foto; zodra die binnen en getekend is (twee
|
||||
// frames later, dus na de eerste paint) ook de volgende en de vorige.
|
||||
// Verder weg laden we pas als de slider in de buurt komt (BR-HERO-01).
|
||||
const [firstPainted, setFirstPainted] = useState(false);
|
||||
const onFirstLoaded = () =>
|
||||
requestAnimationFrame(() =>
|
||||
requestAnimationFrame(() => setFirstPainted(true)),
|
||||
);
|
||||
const loaded = firstPainted
|
||||
? slidesToLoad(active, slides.length)
|
||||
: [active];
|
||||
|
||||
return (
|
||||
<Box
|
||||
@@ -48,21 +63,28 @@ export default function Hero({ content }: HeroProps) {
|
||||
transitionDuration="fade"
|
||||
transitionTimingFunction="smooth"
|
||||
>
|
||||
<Image
|
||||
src={slide.src}
|
||||
alt={slide.alt}
|
||||
fetchPriority={i === 0 ? 'high' : undefined}
|
||||
loading={i === 0 ? undefined : 'lazy'}
|
||||
w="100%"
|
||||
h="100%"
|
||||
objectFit="cover"
|
||||
transform={
|
||||
reducedMotion || i === active
|
||||
? 'scale(1)'
|
||||
: 'scale(1.06)'
|
||||
}
|
||||
transition="transform 9s linear"
|
||||
/>
|
||||
{loaded.includes(i) && (
|
||||
<Image
|
||||
src={slide.src}
|
||||
alt={slide.alt}
|
||||
fetchPriority={i === 0 ? 'high' : undefined}
|
||||
onLoad={
|
||||
firstPainted ? undefined : onFirstLoaded
|
||||
}
|
||||
onError={
|
||||
firstPainted ? undefined : onFirstLoaded
|
||||
}
|
||||
w="100%"
|
||||
h="100%"
|
||||
objectFit="cover"
|
||||
transform={
|
||||
reducedMotion || i === active
|
||||
? 'scale(1)'
|
||||
: 'scale(1.06)'
|
||||
}
|
||||
transition="transform 9s linear"
|
||||
/>
|
||||
)}
|
||||
</Box>
|
||||
))}
|
||||
</Box>
|
||||
|
||||
Reference in New Issue
Block a user