import { Card, Group, Text, ThemeIcon, Stack, Progress, Badge, useComputedColorScheme } from '@mantine/core' import { IconType } from 'react-icons' import { TbTrendingUp, TbTrendingDown } from 'react-icons/tb' interface SummaryCardProps { title: string value: string | number icon: IconType color?: string trend?: { value: string positive: boolean } progress?: { value: number label: string } isError?: boolean onClick?: () => void children?: React.ReactNode } export function SummaryCard({ title, value, icon: Icon, color = 'brand-blue', trend, progress, isError, onClick, children }: SummaryCardProps) { const scheme = useComputedColorScheme('light', { getInitialValueInEffect: true }) return ( ({ root: { backgroundColor: isError && Number(value) > 0 ? (scheme === 'dark' ? 'rgba(239, 68, 68, 0.1)' : 'rgba(255, 241, 242, 1)') // light pink for error in light mode : 'var(--mantine-color-body)', borderColor: isError && Number(value) > 10 ? 'rgba(239, 68, 68, 0.3)' : scheme === 'dark' ? 'rgba(255, 255, 255, 0.08)' : 'rgba(0, 0, 0, 0.05)', transition: 'transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease', '&:hover': { transform: 'translateY(-4px)', } } })} > {trend && ( : } > {trend.value} )} {title.toUpperCase()} {value} {progress && ( {progress.label} {progress.value}% )} {children} ) } import { Box } from '@mantine/core'