| 1 |
import * as React from "react"; |
| 2 |
|
| 3 |
export interface CardProps extends React.HTMLAttributes<HTMLDivElement> {} |
| 4 |
|
| 5 |
const Card = React.forwardRef<HTMLDivElement, CardProps>( |
| 6 |
({ className = "", ...props }, ref) => ( |
| 7 |
<div |
| 8 |
ref={ref} |
| 9 |
className={`rounded-lg border border-gray-100 dark:border-gray-700/50 bg-white dark:bg-gray-800 flex flex-col py-4 ${className}`} |
| 10 |
{...props} |
| 11 |
/> |
| 12 |
), |
| 13 |
); |
| 14 |
Card.displayName = "Card"; |
| 15 |
|
| 16 |
const CardHeader = React.forwardRef<HTMLDivElement, CardProps>( |
| 17 |
({ className = "", ...props }, ref) => ( |
| 18 |
<div |
| 19 |
ref={ref} |
| 20 |
className={`flex flex-col space-y-0.5 p-3 pb-2 border-b border-gray-100 dark:border-gray-700/50 ${className}`} |
| 21 |
{...props} |
| 22 |
/> |
| 23 |
), |
| 24 |
); |
| 25 |
CardHeader.displayName = "CardHeader"; |
| 26 |
|
| 27 |
const CardTitle = React.forwardRef< |
| 28 |
HTMLParagraphElement, |
| 29 |
React.HTMLAttributes<HTMLHeadingElement> |
| 30 |
>(({ className = "", ...props }, ref) => ( |
| 31 |
<h3 |
| 32 |
ref={ref} |
| 33 |
className={`text-base font-semibold text-gray-900 dark:text-white ${className}`} |
| 34 |
{...props} |
| 35 |
/> |
| 36 |
)); |
| 37 |
CardTitle.displayName = "CardTitle"; |
| 38 |
|
| 39 |
const CardDescription = React.forwardRef< |
| 40 |
HTMLParagraphElement, |
| 41 |
React.HTMLAttributes<HTMLParagraphElement> |
| 42 |
>(({ className = "", ...props }, ref) => ( |
| 43 |
<p |
| 44 |
ref={ref} |
| 45 |
className={`text-sm text-gray-500 dark:text-gray-400 ${className}`} |
| 46 |
{...props} |
| 47 |
/> |
| 48 |
)); |
| 49 |
CardDescription.displayName = "CardDescription"; |
| 50 |
|
| 51 |
const CardContent = React.forwardRef<HTMLDivElement, CardProps>( |
| 52 |
({ className = "", ...props }, ref) => ( |
| 53 |
<div ref={ref} className={`p-3 flex-1 ${className}`} {...props} /> |
| 54 |
), |
| 55 |
); |
| 56 |
CardContent.displayName = "CardContent"; |
| 57 |
|
| 58 |
const CardFooter = React.forwardRef<HTMLDivElement, CardProps>( |
| 59 |
({ className = "", ...props }, ref) => ( |
| 60 |
<div |
| 61 |
ref={ref} |
| 62 |
className={`flex items-center p-6 pt-0 ${className}`} |
| 63 |
{...props} |
| 64 |
/> |
| 65 |
), |
| 66 |
); |
| 67 |
CardFooter.displayName = "CardFooter"; |
| 68 |
|
| 69 |
export { |
| 70 |
Card, |
| 71 |
CardHeader, |
| 72 |
CardFooter, |
| 73 |
CardTitle, |
| 74 |
CardDescription, |
| 75 |
CardContent, |
| 76 |
}; |
| 77 |
|