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:
@@ -0,0 +1,62 @@
|
||||
import { chakra } from '@chakra-ui/react';
|
||||
import { Icon } from '@iconify/react/offline';
|
||||
import upOutlined from '@iconify-icons/ant-design/up-outlined';
|
||||
import useScrolledPast from '@/hooks/useScrolledPast';
|
||||
import { backToTopThreshold } from '@/lib/backToTopThreshold';
|
||||
|
||||
// Buiten het component, zodat de functie stabiel is voor useScrolledPast
|
||||
const threshold = () => backToTopThreshold(window.innerHeight);
|
||||
|
||||
// Afstand tot de rand zoals in het design. Op hele brede schermen lijnt de
|
||||
// knop uit met de rand van de content in plaats van de hoek van het scherm.
|
||||
const EDGE = 'clamp(1rem, 3vw, 2rem)';
|
||||
|
||||
// Vaste knop rechtsonder om terug naar boven te gaan (FR-06, BR-TOP-*)
|
||||
export default function BackToTop() {
|
||||
const visible = useScrolledPast(threshold);
|
||||
|
||||
const scrollToTop = () => {
|
||||
const reduced = window.matchMedia(
|
||||
'(prefers-reduced-motion: reduce)',
|
||||
).matches;
|
||||
window.scrollTo({ top: 0, behavior: reduced ? 'instant' : 'smooth' });
|
||||
// De knop verdwijnt bovenaan; de focus gaat naar de inhoud
|
||||
document.getElementById('main')?.focus({ preventScroll: true });
|
||||
};
|
||||
|
||||
return (
|
||||
<chakra.button
|
||||
type="button"
|
||||
onClick={scrollToTop}
|
||||
aria-label="Terug naar boven"
|
||||
data-testid="back-to-top-button"
|
||||
position="fixed"
|
||||
bottom={EDGE}
|
||||
right={`max(${EDGE}, calc((100vw - {sizes.content}) / 2 + {spacing.8}))`}
|
||||
zIndex="backToTop"
|
||||
display="inline-flex"
|
||||
alignItems="center"
|
||||
justifyContent="center"
|
||||
w="46px"
|
||||
h="46px"
|
||||
bg="ink"
|
||||
color="white"
|
||||
fontSize="1.1rem"
|
||||
cursor="pointer"
|
||||
// Verborgen = niet zichtbaar, niet focusbaar, niet klikbaar en
|
||||
// niet voorgelezen (BR-TOP-03); inert dekt dat ook zonder CSS af
|
||||
inert={!visible}
|
||||
visibility={visible ? 'visible' : 'hidden'}
|
||||
opacity={visible ? 1 : 0}
|
||||
transform={visible ? 'none' : 'translateY(8px)'}
|
||||
transitionProperty="opacity, transform, visibility, background-color"
|
||||
transitionDuration="interaction"
|
||||
transitionTimingFunction="smooth"
|
||||
_hover={{ bg: 'accent.deep' }}
|
||||
_focusVisible={{ bg: 'accent.deep' }}
|
||||
_motionReduce={{ transitionDuration: '0s', transform: 'none' }}
|
||||
>
|
||||
<Icon icon={upOutlined} aria-hidden />
|
||||
</chakra.button>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user