Open History to see the last commit
1import type { CardProps } from '@/lib/reports/types'
2
3const variantClasses = {
4 default: 'bg-white/80 border border-sky-200/60 shadow-sm',
5 outlined: 'bg-transparent border-2 border-sky-300/50',
6 elevated: 'bg-white/90 border border-sky-200/60 shadow-lg',
7}
8
9const paddingClasses = {
10 none: 'p-0',
11 sm: 'p-3',
12 md: 'p-4',
13 lg: 'p-6',
14}
15
16export function Card({
17 title,
18 subtitle,
19 variant = 'default',
20 padding = 'md',
21 children,
22}: CardProps) {
23 const hasHeader = title || subtitle
24
25 // When there's a header, we need separate sections for header and content
26 if (hasHeader) {
27 return (
28 <div className={`rounded-lg overflow-hidden ${variantClasses[variant]}`}>
29 <div className="px-4 py-3 bg-gradient-to-r from-sky-100/60 to-sky-50/40 border-b border-sky-200/50">
30 {title && (
31 <h3 className="text-lg font-semibold text-[var(--report-text)]">
32 {title}
33 </h3>
34 )}
35 {subtitle && (
36 <p className="text-sm text-[var(--report-text-muted)] mt-1">
37 {subtitle}
38 </p>
39 )}
40 </div>
41 <div className={paddingClasses[padding]}>{children}</div>
42 </div>
43 )
44 }
45
46 // No header - simpler structure with padding on outer div
47 return (
48 <div
49 className={`rounded-lg ${variantClasses[variant]} ${paddingClasses[padding]}`}
50 >
51 {children}
52 </div>
53 )
54}