| 1 |
import { cn } from '@/lib/utils'; |
| 2 |
|
| 3 |
function Card({ className, size = 'default', ...props }) { |
| 4 |
return ( |
| 5 |
<div |
| 6 |
data-slot="card" |
| 7 |
data-size={size} |
| 8 |
className={cn( |
| 9 |
'disco:group/card disco:flex disco:flex-col disco:gap-4 disco:overflow-hidden disco:rounded-xl disco:bg-card disco:py-4 disco:text-sm disco:text-card-foreground disco:ring-foreground/10 disco:has-data-[slot=card-footer]:pb-0 disco:has-[>img:first-child]:pt-0 disco:data-[size=sm]:gap-3 disco:data-[size=sm]:py-3 disco:data-[size=sm]:has-data-[slot=card-footer]:pb-0 disco:*:[img:first-child]:rounded-t-xl disco:*:[img:last-child]:rounded-b-xl', |
| 10 |
className |
| 11 |
)} |
| 12 |
{...props} |
| 13 |
/> |
| 14 |
); |
| 15 |
} |
| 16 |
|
| 17 |
function CardHeader({ className, ...props }) { |
| 18 |
return ( |
| 19 |
<div |
| 20 |
data-slot="card-header" |
| 21 |
className={cn( |
| 22 |
'disco:group/card-header disco:@container/card-header disco:grid disco:auto-rows-min disco:items-start disco:gap-1 disco:rounded-t-xl disco:px-4 disco:group-data-[size=sm]/card:px-3 disco:has-data-[slot=card-action]:grid-cols-[1fr_auto] disco:has-data-[slot=card-description]:grid-rows-[auto_auto] disco:[.border-b]:pb-4 disco:group-data-[size=sm]/card:[.border-b]:pb-3', |
| 23 |
className |
| 24 |
)} |
| 25 |
{...props} |
| 26 |
/> |
| 27 |
); |
| 28 |
} |
| 29 |
|
| 30 |
function CardTitle({ className, ...props }) { |
| 31 |
return ( |
| 32 |
<div |
| 33 |
data-slot="card-title" |
| 34 |
className={cn( |
| 35 |
'disco:text-base disco:leading-snug disco:font-medium disco:group-data-[size=sm]/card:text-sm', |
| 36 |
className |
| 37 |
)} |
| 38 |
{...props} |
| 39 |
/> |
| 40 |
); |
| 41 |
} |
| 42 |
|
| 43 |
function CardDescription({ className, ...props }) { |
| 44 |
return ( |
| 45 |
<div |
| 46 |
data-slot="card-description" |
| 47 |
className={cn( |
| 48 |
'disco:text-sm disco:text-muted-foreground', |
| 49 |
className |
| 50 |
)} |
| 51 |
{...props} |
| 52 |
/> |
| 53 |
); |
| 54 |
} |
| 55 |
|
| 56 |
function CardAction({ className, ...props }) { |
| 57 |
return ( |
| 58 |
<div |
| 59 |
data-slot="card-action" |
| 60 |
className={cn( |
| 61 |
'disco:col-start-2 disco:row-span-2 disco:row-start-1 disco:self-start disco:justify-self-end', |
| 62 |
className |
| 63 |
)} |
| 64 |
{...props} |
| 65 |
/> |
| 66 |
); |
| 67 |
} |
| 68 |
|
| 69 |
function CardContent({ className, ...props }) { |
| 70 |
return ( |
| 71 |
<div |
| 72 |
data-slot="card-content" |
| 73 |
className={cn( |
| 74 |
'disco:px-4 disco:group-data-[size=sm]/card:px-3', |
| 75 |
className |
| 76 |
)} |
| 77 |
{...props} |
| 78 |
/> |
| 79 |
); |
| 80 |
} |
| 81 |
|
| 82 |
function CardFooter({ className, ...props }) { |
| 83 |
return ( |
| 84 |
<div |
| 85 |
data-slot="card-footer" |
| 86 |
className={cn( |
| 87 |
'disco:flex disco:items-center disco:rounded-b-xl disco:border-t disco:bg-muted/50 disco:p-4 disco:group-data-[size=sm]/card:p-3', |
| 88 |
className |
| 89 |
)} |
| 90 |
{...props} |
| 91 |
/> |
| 92 |
); |
| 93 |
} |
| 94 |
|
| 95 |
export { |
| 96 |
Card, |
| 97 |
CardAction, |
| 98 |
CardContent, |
| 99 |
CardDescription, |
| 100 |
CardFooter, |
| 101 |
CardHeader, |
| 102 |
CardTitle, |
| 103 |
}; |
| 104 |
|