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