1import * as React from "react"
2
3import { cn } from "@/lib/utils"
4
5const TextureCardStyled = React.forwardRef<
6 HTMLDivElement,
7 React.HTMLAttributes<HTMLDivElement> & { children?: React.ReactNode }
8>(({ className, children, ...props }, ref) => (
9 <div
10 ref={ref}
11 className={cn(
12 "rounded-[24px] border border-white/60 dark:border-stone-950/60",
13 "bg-gradient-to-b dark:from-neutral-800 dark:to-neutral-900 from-neutral-100 to-white/70",
14 className
15 )}
16 {...props}
17 >
18 {/* Nested structure for aesthetic borders */}
19 <div className="rounded-[23px] border dark:border-neutral-900/80 border-black/10 ">
20 <div className="rounded-[22px] border dark:border-neutral-950 border-white/50">
21 <div className="rounded-[21px] border dark:border-neutral-900/70 border-neutral-950/20">
22 {/* Inner content wrapper */}
23 <div className=" w-full border border-white/50 dark:border-neutral-700/50 rounded-[20px] text-neutral-500 ">
24 {children}
25 </div>
26 </div>
27 </div>
28 </div>
29 </div>
30))
31
32// Allows for global css overrides and theme support - similar to shad cn
33const TextureCard = React.forwardRef<
34 HTMLDivElement,
35 React.HTMLAttributes<HTMLDivElement> & { children?: React.ReactNode }
36>(({ className, children, ...props }, ref) => {
37 return (
38 <div
39 ref={ref}
40 className={cn(
41 "rounded-lg border border-white/60 dark:border-border/30",
42 "rounded-[calc(var(--radius))]", // Base radius with fallback
43 className
44 )}
45 {...props}
46 >
47 <div className="border dark:border-neutral-900/80 border-black/10 rounded-[calc(var(--radius)-1px)]">
48 <div className="border dark:border-neutral-950 border-white/50 rounded-[calc(var(--radius)-2px)]">
49 <div className="border dark:border-neutral-900/70 border-neutral-950/20 rounded-[calc(var(--radius)-3px)]">
50 <div className=" w-full border border-white/50 dark:border-neutral-700/50 text-neutral-500 bg-gradient-to-b from-card/70 to-secondary/50 rounded-[calc(var(--radius)-4px)] ">
51 {children}
52 </div>
53 </div>
54 </div>
55 </div>
56 </div>
57 )
58})
59
60TextureCard.displayName = "TextureCard"
61
62const TextureCardHeader = React.forwardRef<
63 HTMLDivElement,
64 React.HTMLAttributes<HTMLDivElement>
65>(({ className, ...props }, ref) => (
66 <div
67 ref={ref}
68 className={cn(
69 "first:pt-6 last:pb-6 ", // Adjust padding for first and last child
70 className
71 )}
72 {...props}
73 />
74))
75TextureCardHeader.displayName = "TextureCardHeader"
76
77const TextureCardTitle = React.forwardRef<
78 HTMLHeadingElement,
79 React.HTMLAttributes<HTMLHeadingElement>
80>(({ className, ...props }, ref) => (
81 <h3
82 ref={ref}
83 className={cn(
84 "text-lg font-semibold leading-tight text-neutral-900 dark:text-neutral-100 pl-2",
85 className
86 )}
87 {...props}
88 />
89))
90TextureCardTitle.displayName = "TextureCardTitle"
91
92const TextureCardDescription = React.forwardRef<
93 HTMLParagraphElement,
94 React.HTMLAttributes<HTMLParagraphElement>
95>(({ className, ...props }, ref) => (
96 <p
97 ref={ref}
98 className={cn(
99 "text-sm text-neutral-600 dark:text-neutral-400 pl-2",
100 className
101 )}
102 {...props}
103 />
104))
105TextureCardDescription.displayName = "TextureCardDescription"
106
107const TextureCardContent = React.forwardRef<
108 HTMLDivElement,
109 React.HTMLAttributes<HTMLDivElement>
110>(({ className, ...props }, ref) => (
111 <div ref={ref} className={cn("px-6 py-4", className)} {...props} />
112))
113TextureCardContent.displayName = "TextureCardContent"
114
115const TextureCardFooter = React.forwardRef<
116 HTMLDivElement,
117 React.HTMLAttributes<HTMLDivElement>
118>(({ className, ...props }, ref) => (
119 <div
120 ref={ref}
121 className={cn(
122 "flex items-center justify-between px-6 py-4 gap-2",
123
124 className
125 )}
126 {...props}
127 />
128))
129TextureCardFooter.displayName = "TextureCardFooter"
130
131const TextureSeparator = () => {
132 return (
133 <div className="border border-t-neutral-50 border-b-neutral-300/50 dark:border-t-neutral-950 dark:border-b-neutral-700/50 border-l-transparent border-r-transparent" />
134 )
135}
136
137export {
138 TextureCard,
139 TextureCardHeader,
140 TextureCardStyled,
141 TextureCardFooter,
142 TextureCardTitle,
143 TextureSeparator,
144 TextureCardDescription,
145 TextureCardContent,
146}
147
148export default TextureCard
149