Files
pos-dashboard-v2/src/@core/components/mui/Badge.tsx
T
2025-08-05 12:35:40 +07:00

26 lines
650 B
TypeScript

'use client'
// MUI Imports
import MuiBadge from '@mui/material/Badge'
import type { BadgeProps } from '@mui/material/Badge'
import { styled } from '@mui/material/styles'
export type CustomBadgeProps = BadgeProps & {
tonal?: 'true' | 'false'
}
const Badge = styled(MuiBadge)<CustomBadgeProps>(({ tonal, color }) => {
return {
...(tonal === 'true' && {
'& .MuiBadge-badge.MuiBadge-standard': {
color: `var(--mui-palette-${color}-main)`,
backgroundColor: `var(--mui-palette-${color}-lightOpacity)`
}
})
}
})
const CustomBadge = (props: CustomBadgeProps) => <Badge {...props} />
export default CustomBadge