pos-dashboard-v2/src/views/dashboards/crm/DistributedBarChartOrder.tsx

62 lines
1.6 KiB
TypeScript
Raw Normal View History

2025-08-05 12:35:40 +07:00
'use client'
// Next Imports
// MUI Imports
import Card from '@mui/material/Card'
import CardContent from '@mui/material/CardContent'
// Third-party Imports
2025-08-08 17:59:39 +07:00
import classnames from 'classnames'
import CustomAvatar, { CustomAvatarProps } from '../../../@core/components/mui/Avatar'
import { ThemeColor } from '../../../@core/types'
import { Skeleton, Typography } from '@mui/material'
import { formatShortCurrency } from '../../../utils/transform'
type Props = {
title: string
value: number
2025-08-12 21:29:24 +07:00
isCurrency: boolean
2025-08-08 17:59:39 +07:00
isLoading: boolean
avatarIcon: string
avatarSkin?: CustomAvatarProps['skin']
avatarSize?: number
avatarColor?: ThemeColor
}
2025-08-05 12:35:40 +07:00
2025-08-08 17:59:39 +07:00
const DistributedBarChartOrder = ({
title,
value,
2025-08-12 21:29:24 +07:00
isCurrency = false,
2025-08-08 17:59:39 +07:00
isLoading,
avatarIcon,
avatarSkin,
avatarColor
}: Props) => {
if (isLoading) {
return <Skeleton sx={{ bgcolor: 'grey.100' }} variant='rectangular' width={300} height={118} />
2025-08-05 12:35:40 +07:00
}
return (
<Card>
2025-08-08 17:59:39 +07:00
<CardContent>
<div className='flex items-start justify-between'>
<div className='flex-1'>
<Typography variant='h6' color='text.disabled'>
{title}
</Typography>
<Typography color='text.primary' variant='h4'>
2025-08-12 21:29:24 +07:00
{isCurrency ? 'Rp ' + formatShortCurrency(value) : formatShortCurrency(value)}
2025-08-08 17:59:39 +07:00
</Typography>
</div>
<CustomAvatar variant='rounded' skin={avatarSkin} size={52} color={avatarColor}>
<i className={classnames(avatarIcon, 'text-[28px]')} />
</CustomAvatar>
2025-08-05 12:35:40 +07:00
</div>
</CardContent>
</Card>
)
}
export default DistributedBarChartOrder