// ** React Imports import { useState } from 'react' // ** MUI Imports import Box from '@mui/material/Box' import Card from '@mui/material/Card' import Grid from '@mui/material/Grid' import Badge from '@mui/material/Badge' import Button from '@mui/material/Button' import { useTheme } from '@mui/material/styles' import Typography from '@mui/material/Typography' import CardHeader from '@mui/material/CardHeader' import CardContent from '@mui/material/CardContent' // ** Third Party Components import clsx from 'clsx' import { useKeenSlider } from 'keen-slider/react' // ** Icon Imports import Icon from 'src/@core/components/icon' // ** Custom Components Imports import CustomAvatar from 'src/@core/components/mui/avatar' interface SwiperData { img: string title: string details: { [key: string]: string } } const data: SwiperData[] = [ { title: 'Mobiles & Computers', img: '/images/cards/apple-iphone-x.png', details: { Mobiles: '24', Accessories: '50', Tablets: '12', Computers: '38' } }, { title: 'Appliances & Electronics', img: '/images/cards/ps4-joystick.png', details: { "TV's": '16', Cameras: '9', Speakers: '40', Consoles: '18' } }, { title: 'Fashion', img: '/images/cards/apple-watch-green.png', details: { 'T-shirts': '16', Shoes: '43', Watches: '29', SunGlasses: '7' } } ] const Slides = () => { return ( <> {data.map((slide: SwiperData, index: number) => { return ( {slide.title} {Object.keys(slide.details).map((key: string, index: number) => ( {slide.details[key]} {key} ))} Details Report ) })} > ) } const CardStatisticsWeeklySales = () => { // ** States const [loaded, setLoaded] = useState(false) const [currentSlide, setCurrentSlide] = useState(0) // ** Hook const theme = useTheme() const [sliderRef, instanceRef] = useKeenSlider({ initial: 0, slides: { spacing: 16 }, rtl: theme.direction === 'rtl', slideChanged(slider) { setCurrentSlide(slider.track.details.rel) }, created() { setLoaded(true) } }) return ( Total $23.5k Earning +62% } action={ loaded && instanceRef.current && ( {[...Array(instanceRef.current.track.details.slides.length).keys()].map(idx => { return ( instanceRef.current?.moveToIdx(idx)} sx={{ mr: theme => `${theme.spacing(2.5)} !important`, '& .MuiBadge-dot': { minWidth: 6, width: '6px !important', height: '6px !important' } }} > ) })} ) } /> ) } export default CardStatisticsWeeklySales