UNPKG

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.

150 lines (142 loc) 4.81 kB
// ** MUI Imports import Box from '@mui/material/Box' import Card from '@mui/material/Card' import Typography from '@mui/material/Typography' import IconButton from '@mui/material/IconButton' import CardHeader from '@mui/material/CardHeader' import CardContent from '@mui/material/CardContent' // ** Icons Imports import ChevronUp from 'mdi-material-ui/ChevronUp' import ChevronDown from 'mdi-material-ui/ChevronDown' import DotsVertical from 'mdi-material-ui/DotsVertical' // ** Custom Components Imports import CustomAvatar from '~/@core/components/mui/avatar' const data = [ { sales: '894k', trendDir: 'up', subtitle: 'USA', title: '$8,656k', avatarText: 'US', trendNumber: '25.8%', avatarColor: 'success', trend: <ChevronUp sx={{ color: 'success.main', fontWeight: 600 }} /> }, { sales: '645k', subtitle: 'UK', trendDir: 'down', title: '$2,415k', avatarText: 'UK', trendNumber: '6.2%', avatarColor: 'error', trend: <ChevronDown sx={{ color: 'error.main', fontWeight: 600 }} /> }, { sales: '148k', title: '$865k', trendDir: 'up', avatarText: 'IN', subtitle: 'India', trendNumber: '12.4%', avatarColor: 'warning', trend: <ChevronUp sx={{ color: 'success.main', fontWeight: 600 }} /> }, { sales: '86k', title: '$745k', trendDir: 'down', avatarText: 'JA', subtitle: 'Japan', trendNumber: '11.9%', avatarColor: 'secondary', trend: <ChevronDown sx={{ color: 'error.main', fontWeight: 600 }} /> }, { sales: '42k', title: '$45k', trendDir: 'up', avatarText: 'KO', subtitle: 'Korea', trendNumber: '16.2%', avatarColor: 'error', trend: <ChevronUp sx={{ color: 'success.main', fontWeight: 600 }} /> } ] const AnalyticsSalesByCountries = () => { return ( <Card> <CardHeader title='Sales by Countries' titleTypographyProps={{ sx: { lineHeight: '1.2 !important', letterSpacing: '0.31px !important' } }} action={ <IconButton size='small' aria-label='settings' className='card-more-options' sx={{ color: 'text.secondary' }}> <DotsVertical /> </IconButton> } /> <CardContent sx={{ pt: theme => `${theme.spacing(2)} !important` }}> {data.map((item, index) => { return ( <Box key={item.title} sx={{ display: 'flex', alignItems: 'center', ...(index !== data.length - 1 ? { mb: 6.25 } : {}) }} > <CustomAvatar skin='light' color={item.avatarColor} sx={{ width: 38, height: 38, mr: 3, fontSize: '1rem' }} > {item.avatarText} </CustomAvatar> <Box sx={{ width: '100%', display: 'flex', flexWrap: 'wrap', alignItems: 'center', justifyContent: 'space-between' }} > <Box sx={{ mr: 2, display: 'flex', flexDirection: 'column' }}> <Box sx={{ display: 'flex' }}> <Typography sx={{ mr: 0.5, fontWeight: 600, letterSpacing: '0.25px' }}>{item.title}</Typography> <Box sx={{ display: 'flex', alignItems: 'center' }}> {item.trend} <Typography variant='caption' sx={{ fontWeight: 600, lineHeight: 1.5, color: item.trendDir === 'down' ? 'error.main' : 'success.main' }} > {item.trendNumber} </Typography> </Box> </Box> <Typography variant='caption' sx={{ lineHeight: 1.5 }}> {item.subtitle} </Typography> </Box> <Box sx={{ display: 'flex', textAlign: 'end', flexDirection: 'column' }}> <Typography sx={{ fontWeight: 600, fontSize: '0.875rem', lineHeight: 1.72, letterSpacing: '0.22px' }}> {item.sales} </Typography> <Typography variant='caption' sx={{ lineHeight: 1.5 }}> Sales </Typography> </Box> </Box> </Box> ) })} </CardContent> </Card> ) } export default AnalyticsSalesByCountries