// ** 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 { useTheme } from '@mui/material/styles'
import Typography from '@mui/material/Typography'
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'
import Image from 'next/image'
interface SwiperData {
img: string
title: string
details: { [key: string]: string }
}
const data: SwiperData[] = [
{
title: 'Mobiles & Computers',
img: '/images/cards/apple-iphone-x-lg.png',
details: {
Mobiles: '24',
Accessories: '50',
Tablets: '12',
Computers: '38'
}
},
{
title: 'Appliances & Electronics',
img: '/images/cards/ps4-joystick-lg.png',
details: {
"TV's": '16',
Cameras: '9',
Speakers: '40',
Consoles: '18'
}
},
{
title: 'Fashion',
img: '/images/cards/apple-watch-green-lg.png',
details: {
'T-shirts': '16',
Shoes: '43',
Watches: '29',
SunGlasses: '7'
}
}
]
const Slides = () => {
return (
<>
{data.map((slide: SwiperData, index: number) => {
return (
Weekly Sales
Total $23.5k Earning
+62%
{slide.title}
{Object.keys(slide.details).map((key: string, index: number) => {
return (
{slide.details[key]}
{key}
)
})}
)
})}
>
)
}
const CardStatisticsWeeklySalesBg = () => {
// ** States
const [loaded, setLoaded] = useState(false)
const [currentSlide, setCurrentSlide] = useState(0)
// ** Hook
const theme = useTheme()
const [sliderRef, instanceRef] = useKeenSlider({
initial: 0,
rtl: theme.direction === 'rtl',
slideChanged(slider) {
setCurrentSlide(slider.track.details.rel)
},
created() {
setLoaded(true)
}
})
return (
{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`,
'&.active': {
'& .MuiBadge-dot': {
backgroundColor: theme => `${theme.palette.common.white} !important`
}
},
'& .MuiBadge-dot': {
height: '6px !important',
width: '6px !important',
minWidth: '6px !important'
}
}}
>
)
})}
)}
)
}
export default CardStatisticsWeeklySalesBg