import React, { useEffect, useRef } from 'react' import 'keen-slider/keen-slider.min.css' import { CustomCarouselArrow } from './CustomArrow/CustomCarouselArrow' import s from './CarouselCommon.module.scss' import classNames from 'classnames' import Carousel from 'react-multi-carousel' import 'react-multi-carousel/lib/styles.css' import { ResponsiveType, CarouselProps, ButtonGroupProps, } from 'react-multi-carousel/lib/types' export interface CarouselCommonProps extends Omit { data: T[] Component: React.ComponentType itemKey: String keenClassname?: string isPadding?: boolean defaultComponentProps?: object responsive?: ResponsiveType } const RESPONSIVE = { desktop: { breakpoint: { max: 3000, min: 1024 }, items: 3, slidesToSlide: 3, // optional, default to 1. }, tablet: { breakpoint: { max: 1024, min: 464 }, items: 2, slidesToSlide: 2, // optional, default to 1. }, mobile: { breakpoint: { max: 464, min: 0 }, items: 1, slidesToSlide: 1, // optional, default to 1. }, } const CarouselCommon = ({ data = [], Component, itemKey, defaultComponentProps, responsive = RESPONSIVE, showDots, isPadding, arrows, ...props }: CarouselCommonProps) => { const carousel = useRef(null) const handleRightArrowClick = () => { carousel.current?.next(carousel.current.props.slidesToSlide||1) } const handleLeftArrowClick = () => { carousel.current?.previous(carousel.current.props.slidesToSlide||1) } return (
} renderButtonGroupOutside sliderClass={''} containerClass={classNames({ [s.showDots]: showDots, [s.isPadding]: isPadding, })} responsive={responsive} arrows={false} renderDotsOutside={true} ssr={true} // customLeftArrow={} // customRightArrow={} > {data.map((props, index) => { const allProps = defaultComponentProps ? { ...props, ...defaultComponentProps } : props return })} {carousel && arrows && ( <> )} {/* {slider && isDot && (
{dotArr.map((index) => { return ( ) })}
)} */}
) } const CarouselButtonGroup = ({ next, previous }: ButtonGroupProps) => { return ( <> ) } export default CarouselCommon