The prerendered hero is plain HTML between the markers (first photo, h1, buttons), the slider takes over after hydration with the hero of the host block, the API or the build. The head preload is added to the finished HTML. Hero texts move into nl.json. The stand-in host and the e2e tests cover the hero. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
63 lines
1.9 KiB
TypeScript
63 lines
1.9 KiB
TypeScript
import { chakra, useRecipe } from '@chakra-ui/react';
|
|
import { t } from '@/i18n';
|
|
import { Icon } from '@iconify/react/offline';
|
|
import leftOutlined from '@iconify-icons/ant-design/left-outlined';
|
|
import rightOutlined from '@iconify-icons/ant-design/right-outlined';
|
|
|
|
type HeroArrowsProps = {
|
|
onPrev: () => void;
|
|
onNext: () => void;
|
|
};
|
|
|
|
// Pijlen links en rechts, verticaal gecentreerd
|
|
export default function HeroArrows({ onPrev, onNext }: HeroArrowsProps) {
|
|
return (
|
|
<>
|
|
<ArrowButton
|
|
side="left"
|
|
aria-label={t('hero.prev')}
|
|
data-testid="hero-prev-button"
|
|
data-requires-js
|
|
onClick={onPrev}
|
|
>
|
|
<Icon icon={leftOutlined} aria-hidden />
|
|
</ArrowButton>
|
|
<ArrowButton
|
|
side="right"
|
|
aria-label={t('hero.next')}
|
|
data-testid="hero-next-button"
|
|
data-requires-js
|
|
onClick={onNext}
|
|
>
|
|
<Icon icon={rightOutlined} aria-hidden />
|
|
</ArrowButton>
|
|
</>
|
|
);
|
|
}
|
|
|
|
type ArrowButtonProps = React.ComponentProps<typeof chakra.button> & {
|
|
side: 'left' | 'right';
|
|
};
|
|
|
|
const ARROW_OFFSET = 'clamp(0.5rem, 3vw, 2.5rem)';
|
|
|
|
function ArrowButton({ side, ...props }: ArrowButtonProps) {
|
|
// Doorzichtigheid, hover en witte focusring komen uit de iconControl-recipe
|
|
const iconControl = useRecipe({ key: 'iconControl' });
|
|
|
|
return (
|
|
<chakra.button
|
|
type="button"
|
|
css={iconControl()}
|
|
position="absolute"
|
|
top="50%"
|
|
left={side === 'left' ? ARROW_OFFSET : undefined}
|
|
right={side === 'right' ? ARROW_OFFSET : undefined}
|
|
zIndex={2}
|
|
transform="translateY(-50%)"
|
|
fontSize={{ base: '1.5rem', md: '2rem' }}
|
|
{...props}
|
|
/>
|
|
);
|
|
}
|