/** @jsx jsx */ import { FC } from 'react' import { Box, jsx, useSlider } from '@vtex/store-ui' import CarouselArrowLeft from './ArrowLeft' import CarouselArrowRight from './ArrowRight' import CarouselPaginationDots from './PaginationDots' import CarouselPage, { Item } from './Page' interface Props { allItems: Item[] loading?: 'lazy' | 'eager' showArrows?: boolean showDots?: boolean autoplay?: number variant?: string } const Carousel: FC = ({ allItems, loading = 'eager', showArrows = true, showDots = true, autoplay, variant = 'carousel', }) => { const { page, items, totalPages, setPage, setNextPage, setPreviousPage, dragHandlers, } = useSlider({ allItems, pageSize: 1, autoplay, }) // this is safe, since there is only one item per page const [item] = items return ( {showArrows ? ( setPreviousPage()} /> ) : null} {showArrows ? ( setNextPage()} /> ) : null} {showDots ? ( ) : null} ) } export default Carousel