react-garden
Version:
React + TypeScript + ThreeJS app using Material UI on NextJS, Apollo Client, GraphQL + WordPress REST APIs, for ThreeD web development.. a part of the threed.ai code family.
99 lines (92 loc) • 2.94 kB
JavaScript
// ** MUI Imports
import Box from '@mui/material/Box'
import Grid from '@mui/material/Grid'
import Card from '@mui/material/Card'
import CardHeader from '@mui/material/CardHeader'
import IconButton from '@mui/material/IconButton'
import Typography from '@mui/material/Typography'
import CardContent from '@mui/material/CardContent'
// ** Icons Imports
import TrendingUp from 'mdi-material-ui/TrendingUp'
import CurrencyUsd from 'mdi-material-ui/CurrencyUsd'
import DotsVertical from 'mdi-material-ui/DotsVertical'
import CellphoneLink from 'mdi-material-ui/CellphoneLink'
import AccountOutline from 'mdi-material-ui/AccountOutline'
// ** Custom Components Imports
import CustomAvatar from '~/@core/components/mui/avatar'
const salesData = [
{
stats: '245k',
title: 'Sales',
color: 'primary',
icon: <TrendingUp sx={{ fontSize: '1.75rem' }} />
},
{
stats: '12.5k',
title: 'Customers',
color: 'success',
icon: <AccountOutline sx={{ fontSize: '1.75rem' }} />
},
{
stats: '1.54k',
color: 'warning',
title: 'Products',
icon: <CellphoneLink sx={{ fontSize: '1.75rem' }} />
},
{
stats: '$88k',
color: 'info',
title: 'Revenue',
icon: <CurrencyUsd sx={{ fontSize: '1.75rem' }} />
}
]
const renderStats = () => {
return salesData.map((item, index) => (
<Grid item xs={12} sm={3} key={index}>
<Box key={index} sx={{ display: 'flex', alignItems: 'center' }}>
<CustomAvatar variant='rounded' color={item.color} sx={{ mr: 3, boxShadow: 3, width: 44, height: 44 }}>
{item.icon}
</CustomAvatar>
<Box sx={{ display: 'flex', flexDirection: 'column' }}>
<Typography variant='caption'>{item.title}</Typography>
<Typography variant='h6'>{item.stats}</Typography>
</Box>
</Box>
</Grid>
))
}
const AnalyticsStatisticsCard = () => {
return (
<Card>
<CardHeader
title='Statistics Card'
action={
<IconButton size='small' aria-label='settings' className='card-more-options' sx={{ color: 'text.secondary' }}>
<DotsVertical />
</IconButton>
}
subheader={
<Typography variant='body2'>
<Box component='span' sx={{ fontWeight: 600, color: 'text.primary' }}>
Total 48.5% growth
</Box>{' '}
😎 this month
</Typography>
}
titleTypographyProps={{
sx: {
mb: 2.5,
lineHeight: '2rem !important',
letterSpacing: '0.15px !important'
}
}}
/>
<CardContent sx={{ pt: theme => `${theme.spacing(3)} !important` }}>
<Grid container spacing={[5, 0]}>
{renderStats()}
</Grid>
</CardContent>
</Card>
)
}
export default AnalyticsStatisticsCard