Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | 1x 1x 1x 5x 25x 1x | import {
CarouselContainer,
CarouselInner,
CarouselSlide,
NextButton,
PrevButton
} from "./styled"
import { ComponentProps } from "."
import Icon from "components/Icon"
const Carousel = ({
children,
className,
onNext,
onPrev,
onTouchEnd,
onTouchMove,
onTouchStart,
slidesToShow,
translateX
}: ComponentProps) => {
return (
<CarouselContainer
aria-atomic="true"
aria-label="Carousel"
aria-live="polite"
className={className}
onTouchEnd={onTouchEnd}
onTouchMove={onTouchMove}
onTouchStart={onTouchStart}
role="region"
>
<CarouselInner $translateX={translateX}>
{children.map((child, index) => (
// eslint-disable-next-line react/no-array-index-key
<CarouselSlide $slidesToShow={slidesToShow} key={index}>
{child}
</CarouselSlide>
))}
</CarouselInner>
<PrevButton
icon={<Icon group="io5" name="IoChevronBack" size="36px" />}
iconOnly
label="Prev"
noHoverHighlight
onClick={onPrev}
/>
<NextButton
icon={<Icon group="io5" name="IoChevronForward" size="36px" />}
iconOnly
label="Next"
noHoverHighlight
onClick={onNext}
/>
</CarouselContainer>
)
}
export default Carousel
|