File size: 2,233 Bytes
80bcac8 ffd0276 80bcac8 ffd0276 80bcac8 ffd0276 80bcac8 ffd0276 80bcac8 ffd0276 80bcac8 ffd0276 80bcac8 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | 'use client'
import { forwardRef, HTMLAttributes } from 'react'
import { cn } from '@/utils/helpers'
export interface CardProps extends HTMLAttributes<HTMLDivElement> {
variant?: 'default' | 'outlined' | 'elevated'
}
export const Card = forwardRef<HTMLDivElement, CardProps>(
({ className, variant = 'default', children, ...props }, ref) => {
const variants = {
default: 'clay-card',
outlined: 'clay-card border-2',
elevated: 'clay-card shadow-lg',
}
return (
<div
ref={ref}
className={cn('rounded-2xl', variants[variant], className)}
{...props}
>
{children}
</div>
)
}
)
Card.displayName = 'Card'
export const CardHeader = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(
({ className, children, ...props }, ref) => (
<div ref={ref} className={cn('px-6 py-4 border-b border-current/20', className)} {...props}>
{children}
</div>
)
)
CardHeader.displayName = 'CardHeader'
export const CardTitle = forwardRef<HTMLHeadingElement, HTMLAttributes<HTMLHeadingElement>>(
({ className, children, ...props }, ref) => (
<h3 ref={ref} className={cn('text-lg font-semibold text-current', className)} {...props}>
{children}
</h3>
)
)
CardTitle.displayName = 'CardTitle'
export const CardDescription = forwardRef<HTMLParagraphElement, HTMLAttributes<HTMLParagraphElement>>(
({ className, children, ...props }, ref) => (
<p ref={ref} className={cn('text-sm text-current/70 mt-1', className)} {...props}>
{children}
</p>
)
)
CardDescription.displayName = 'CardDescription'
export const CardContent = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(
({ className, children, ...props }, ref) => (
<div ref={ref} className={cn('px-6 py-4', className)} {...props}>
{children}
</div>
)
)
CardContent.displayName = 'CardContent'
export const CardFooter = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(
({ className, children, ...props }, ref) => (
<div ref={ref} className={cn('px-6 py-4 border-t border-current/20 flex items-center gap-2', className)} {...props}>
{children}
</div>
)
)
CardFooter.displayName = 'CardFooter' |