| 1 | import Link from 'next/link' |
| 2 | import { Card } |
| 3 | import { cn } |
| 4 | import type { RouteImpl |
| 5 | |
| 6 | interface StatCardProps { |
| 7 | href?: string |
| 8 | icon: React |
| 9 | label: string |
| 10 | sublabel?: string |
| 11 | value: string |
| 12 | } |
| 13 | |
| 14 | export function StatCard({ |
| 15 | icon: Icon, |
| 16 | label, |
| 17 | value, |
| 18 | sublabel, |
| 19 | href, |
| 20 | }: StatCardProps) |
| 21 | const content = |
| 22 | <Card |
| 23 | className={cn( |
| 24 | 'gap-0 p-4', |
| 25 | href && 'transition-colors hover:border-primary/50' |
| 26 | )} |
| 27 | > |
| 28 | <div className='flex items-center gap-2 text-muted-foreground |
| 29 | <Icon className=' |
| 30 | <span className='text-sm |
| 31 | </div> |
| 32 | <div className='mt-2 font-semibold text-2xl |
| 33 | <p className='mt-1 text-muted-foreground text-xs |
| 34 | {sublabel ?? '\u00A0 |
| 35 | </p> |
| 36 | </Card> |
| 37 | ) |
| 38 | |
| 39 | if (href) { |
| 40 | return <Link href |
| 41 | } |
| 42 | |
| 43 | return content |
| 44 | } |