import { Group, SimpleGrid, Text } from '@mantine/core' import { IconArrowDownRight, IconArrowUpRight, IconCoin, IconDiscount2, IconReceipt2, IconUserPlus, } from '@tabler/icons-react' import MyPaper from '../MyPaper/MyPaper' import classes from './Stats.module.css' const icons = { user: IconUserPlus, discount: IconDiscount2, receipt: IconReceipt2, coin: IconCoin, } const data = [ { title: 'Revenue', icon: 'receipt', value: '13,456', diff: 34 }, { title: 'Profit', icon: 'coin', value: '4,145', diff: -13 }, { title: 'Coupons usage', icon: 'discount', value: '745', diff: 18 }, { title: 'New customers', icon: 'user', value: '188', diff: -30 }, ] as const export default function MyStats() { const stats = data.map((stat) => { const Icon = icons[stat.icon] const DiffIcon = stat.diff > 0 ? IconArrowUpRight : IconArrowDownRight return ( {stat.title} 0 ? 'teal' : 'red'} size="1.4rem" stroke={1.5} /> {stat.value} 0 ? 'teal' : 'red'} fz="sm" fw={600} className={classes.diff} > {stat.diff}% Compared to previous month ) }) return {stats} }