|
| 1 | +import * as React from 'react'; |
| 2 | +import { cn } from '@/lib/utils'; |
| 3 | + |
| 4 | +const Card = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>( |
| 5 | + ({ className, ...props }, ref) => ( |
| 6 | + <div |
| 7 | + ref={ref} |
| 8 | + className={cn( |
| 9 | + 'rounded-lg border border-gray-200 bg-white text-gray-950 shadow-sm dark:border-gray-700 dark:bg-gray-800 dark:text-gray-50', |
| 10 | + className |
| 11 | + )} |
| 12 | + {...props} |
| 13 | + /> |
| 14 | + ) |
| 15 | +); |
| 16 | +Card.displayName = 'Card'; |
| 17 | + |
| 18 | +const CardHeader = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>( |
| 19 | + ({ className, ...props }, ref) => ( |
| 20 | + <div |
| 21 | + ref={ref} |
| 22 | + className={cn('flex flex-col space-y-1.5 p-6', className)} |
| 23 | + {...props} |
| 24 | + /> |
| 25 | + ) |
| 26 | +); |
| 27 | +CardHeader.displayName = 'CardHeader'; |
| 28 | + |
| 29 | +const CardTitle = React.forwardRef<HTMLHeadingElement, React.HTMLAttributes<HTMLHeadingElement>>( |
| 30 | + ({ className, ...props }, ref) => ( |
| 31 | + <h3 |
| 32 | + ref={ref} |
| 33 | + className={cn('text-2xl font-semibold leading-none tracking-tight', className)} |
| 34 | + {...props} |
| 35 | + /> |
| 36 | + ) |
| 37 | +); |
| 38 | +CardTitle.displayName = 'CardTitle'; |
| 39 | + |
| 40 | +const CardDescription = React.forwardRef<HTMLParagraphElement, React.HTMLAttributes<HTMLParagraphElement>>( |
| 41 | + ({ className, ...props }, ref) => ( |
| 42 | + <p |
| 43 | + ref={ref} |
| 44 | + className={cn('text-sm text-gray-500 dark:text-gray-400', className)} |
| 45 | + {...props} |
| 46 | + /> |
| 47 | + ) |
| 48 | +); |
| 49 | +CardDescription.displayName = 'CardDescription'; |
| 50 | + |
| 51 | +const CardContent = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>( |
| 52 | + ({ className, ...props }, ref) => ( |
| 53 | + <div ref={ref} className={cn('p-6 pt-0', className)} {...props} /> |
| 54 | + ) |
| 55 | +); |
| 56 | +CardContent.displayName = 'CardContent'; |
| 57 | + |
| 58 | +const CardFooter = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>( |
| 59 | + ({ className, ...props }, ref) => ( |
| 60 | + <div |
| 61 | + ref={ref} |
| 62 | + className={cn('flex items-center p-6 pt-0', className)} |
| 63 | + {...props} |
| 64 | + /> |
| 65 | + ) |
| 66 | +); |
| 67 | +CardFooter.displayName = 'CardFooter'; |
| 68 | + |
| 69 | +export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent }; |
0 commit comments