Files
AndreaSlopFotografie/web/src/components/Hero/HeroPauseButton.tsx
T
SluijsensandClaude Opus 5.5 46fb2f6b5c
Continuous Integration / check (pull_request) Successful in 59s
Continuous Integration / deploy-test (pull_request) Skipped
Continuous Integration / lighthouse (pull_request) Successful in 3m59s
Continuous Integration / deploy-production (pull_request) Skipped
Announces manual hero slide changes and adds a pause button
Screen readers now hear the new photo after an arrow or swipe, while automatic
changes stay silent. A pause button bottom right lets visitors stop the slide
show, which hover and keyboard focus alone did not allow on touch screens.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 19:31:31 +02:00

43 lines
1.3 KiB
TypeScript

import { chakra, useRecipe } from '@chakra-ui/react';
import { Icon } from '@iconify/react/offline';
import caretRightOutlined from '@iconify-icons/ant-design/caret-right-outlined';
import pauseOutlined from '@iconify-icons/ant-design/pause-outlined';
type HeroPauseButtonProps = {
stopped: boolean;
onToggle: () => void;
};
// Rechtsonder, spiegelbeeld van de socials linksonder. De naam wisselt mee
// met de stand (W3C carrouselpatroon), daarom geen aria-pressed.
export default function HeroPauseButton({
stopped,
onToggle,
}: HeroPauseButtonProps) {
const iconControl = useRecipe({ key: 'iconControl' });
return (
<chakra.button
type="button"
aria-label={
stopped
? 'Diavoorstelling afspelen'
: 'Diavoorstelling pauzeren'
}
data-testid="hero-pause-button"
onClick={onToggle}
css={iconControl()}
position="absolute"
right="gutter"
bottom={{ base: 6, md: 10 }}
zIndex={2}
fontSize="1.5rem"
>
<Icon
icon={stopped ? caretRightOutlined : pauseOutlined}
aria-hidden
/>
</chakra.button>
);
}