// ** React Imports import { useState } from 'react' // ** MUI Imports import Box from '@mui/material/Box' import Badge from '@mui/material/Badge' import { Direction } from '@mui/material' import Image from 'next/image' // ** Icon Imports import Icon from 'src/@core/components/icon' // ** Third Party Components import clsx from 'clsx' import { useKeenSlider } from 'keen-slider/react' const SwiperControls = ({ direction }: { direction: Direction }) => { // ** States const [loaded, setLoaded] = useState(false) const [currentSlide, setCurrentSlide] = useState(0) // ** Hook const [sliderRef, instanceRef] = useKeenSlider({ rtl: direction === 'rtl', slideChanged(slider) { setCurrentSlide(slider.track.details.rel) }, created() { setLoaded(true) } }) return ( <> swiper 1 swiper 2 swiper 3 swiper 4 swiper 5 {loaded && instanceRef.current && ( <> e.stopPropagation() || instanceRef.current?.prev()} /> e.stopPropagation() || instanceRef.current?.next()} /> )} {loaded && instanceRef.current && ( {[...Array(instanceRef.current.track.details.slides.length).keys()].map(idx => { return ( { instanceRef.current?.moveToIdx(idx) }} > ) })} )} ) } export default SwiperControls