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