| 1 | import * as React from "react"; |
| 2 | import { cn } from "../../lib/utils"; |
| 3 | |
| 4 | const Card = React.forwardRef< |
| 5 | HTMLDivElement, |
| 6 | React.HTMLAttributes<HTMLDivElement> |
| 7 | >(({ className, ...props }, ref) => ( |
| 8 | <div |
| 9 | ref={ref} |
| 10 | className={cn( |
| 11 | "rounded-lg border bg-card text-card-foreground shadow-sm", |
| 12 | className, |
| 13 | )} |
| 14 | {...props} |
| 15 | /> |
| 16 | )); |
| 17 | Card.displayName = "Card"; |
| 18 | |
| 19 | const CardHeader = React.forwardRef< |
| 20 | HTMLDivElement, |
| 21 | React.HTMLAttributes<HTMLDivElement> |
| 22 | >(({ className, ...props }, ref) => ( |
| 23 | <div |
| 24 | ref={ref} |
| 25 | className={cn("flex flex-col space-y-1.5 p-6", className)} |
| 26 | {...props} |
| 27 | /> |
| 28 | )); |
| 29 | CardHeader.displayName = "CardHeader"; |
| 30 | |
| 31 | const CardTitle = React.forwardRef< |
| 32 | HTMLParagraphElement, |
| 33 | React.HTMLAttributes<HTMLHeadingElement> |
| 34 | >(({ className, ...props }, ref) => ( |
| 35 | <h3 |
| 36 | ref={ref} |
| 37 | className={cn( |
| 38 | "text-2xl font-semibold leading-none tracking-tight", |
| 39 | className, |
| 40 | )} |
| 41 | {...props} |
| 42 | /> |
| 43 | )); |
| 44 | CardTitle.displayName = "CardTitle"; |
| 45 | |
| 46 | const CardDescription = React.forwardRef< |
| 47 | HTMLParagraphElement, |
| 48 | React.HTMLAttributes<HTMLParagraphElement> |
| 49 | >(({ className, ...props }, ref) => ( |
| 50 | <p |
| 51 | ref={ref} |
| 52 | className={cn("text-sm text-muted-foreground", className)} |
| 53 | {...props} |
| 54 | /> |
| 55 | )); |
| 56 | CardDescription.displayName = "CardDescription"; |
| 57 | |
| 58 | const CardContent = React.forwardRef< |
| 59 | HTMLDivElement, |
| 60 | React.HTMLAttributes<HTMLDivElement> |
| 61 | >(({ className, ...props }, ref) => ( |
| 62 | <div ref={ref} className={cn("p-6 pt-0", className)} {...props} /> |
| 63 | )); |
| 64 | CardContent.displayName = "CardContent"; |
| 65 | |
| 66 | const CardFooter = React.forwardRef< |
| 67 | HTMLDivElement, |
| 68 | React.HTMLAttributes<HTMLDivElement> |
| 69 | >(({ className, ...props }, ref) => ( |
| 70 | <div |
| 71 | ref={ref} |
| 72 | className={cn("flex items-center p-6 pt-0", className)} |
| 73 | {...props} |
| 74 | /> |
| 75 | )); |
| 76 | CardFooter.displayName = "CardFooter"; |
| 77 | |
| 78 | export { |
| 79 | Card, |
| 80 | CardHeader, |
| 81 | CardFooter, |
| 82 | CardTitle, |
| 83 | CardDescription, |
| 84 | CardContent, |
| 85 | }; |