diff --git a/src/components/ui/Card.tsx b/src/components/ui/Card.tsx index d55f58b..b1d5f21 100644 --- a/src/components/ui/Card.tsx +++ b/src/components/ui/Card.tsx @@ -1,163 +1,197 @@ "use client"; -import React from 'react'; -import { - Card as HeroUICard, - CardHeader as HeroUICardHeader, - CardFooter as HeroUICardFooter, - CardProps as HeroUICardProps, -} from '@heroui/react'; -import { tv } from '@heroui/styles'; -const cardStyles = tv({ - // Desactivamos los estilos de sombra/borde base de HeroUI para tener control total - base: 'rounded-2xl overflow-hidden transition-colors border-none shadow-none', - variants: { - customVariant: { - default: 'bg-white dark:bg-slate-900/90 border border-slate-200 dark:border-slate-800/80 shadow-sm', - elevated: 'bg-white dark:bg-slate-900 border border-slate-100 dark:border-slate-800 shadow-xl shadow-slate-200/50 dark:shadow-black/40', - glass: 'bg-white/80 dark:bg-slate-900/60 backdrop-blur-xl border border-slate-200/70 dark:border-slate-800/70 shadow-lg', - outline: 'bg-transparent border border-slate-300 dark:border-slate-800 shadow-none', - interactive: 'bg-white dark:bg-slate-900/90 border border-slate-200 dark:border-slate-800 shadow-sm hover:shadow-xl hover:shadow-cyan-500/10 hover:border-cyan-500/50 dark:hover:border-cyan-500/40 cursor-pointer transform hover:-translate-y-1 transition-all duration-300 ease-out', - }, - customPadding: { - none: 'p-0', - sm: 'p-4', - md: 'p-6', - lg: 'p-8', - } - }, - defaultVariants: { - customVariant: 'default', - customPadding: 'none', - } -}); +import React from "react"; +import { Card as HeroUICard } from "@heroui/react"; -// 1. Omitimos las props conflictivas y declaramos tu API -export interface CardProps extends Omit { - variant?: 'default' | 'elevated' | 'glass' | 'outline' | 'interactive'; - padding?: 'none' | 'sm' | 'md' | 'lg'; +export type CardVariant = + | "default" + | "elevated" + | "glass" + | "outline" + | "interactive"; + +export type CardPadding = "none" | "sm" | "md" | "lg"; + +export interface CardProps + extends Omit< + React.ComponentProps, + "variant" | "className" + > { + variant?: CardVariant; + padding?: CardPadding; className?: string; - children?: React.ReactNode; } -export const Card = React.forwardRef( - ( - { - variant = 'default', - padding = 'none', - className = '', - children, - ...props - }, - ref - ) => { - return ( - - {children} - - ); - } -); -Card.displayName = 'Card'; +const variantStyles: Record = { + default: + "bg-white dark:bg-slate-900/90 border border-slate-200 dark:border-slate-800/80 shadow-sm", -// 2. Subcomponentes: Mapeados a HeroUI -export interface CardHeaderProps extends React.HTMLAttributes { + elevated: + "bg-white dark:bg-slate-900 border border-slate-100 dark:border-slate-800 shadow-xl shadow-slate-200/50 dark:shadow-black/40", + + glass: + "bg-white/80 dark:bg-slate-900/60 backdrop-blur-xl border border-slate-200/70 dark:border-slate-800/70 shadow-lg", + + outline: + "bg-transparent border border-slate-300 dark:border-slate-800 shadow-none", + + interactive: + "bg-white dark:bg-slate-900/90 border border-slate-200 dark:border-slate-800 shadow-sm " + + "hover:shadow-xl hover:shadow-cyan-500/10 " + + "hover:border-cyan-500/50 dark:hover:border-cyan-500/40 " + + "cursor-pointer transform hover:-translate-y-1 " + + "transition-all duration-300 ease-out", +}; + +const paddingStyles: Record = { + none: "p-0", + sm: "p-4", + md: "p-6", + lg: "p-8", +}; + +export const Card = ({ + variant = "default", + padding = "none", + className = "", + children, + ...props +}: CardProps) => { + return ( + + {children} + + ); +}; + +export interface CardHeaderProps + extends React.ComponentProps { bordered?: boolean; } -export const CardHeader: React.FC = ({ +export const CardHeader = ({ bordered = false, - className = '', + className = "", children, ...props -}) => { +}: CardHeaderProps) => { return ( - {children} - + ); }; -// 3. CardTitle y CardDescription: Se mantienen como HTML estándar -export const CardTitle: React.FC> = ({ - className = '', +export const CardTitle = ({ + className = "", children, ...props -}) => { +}: React.ComponentProps) => { return ( -

{children} -

+ ); }; -export const CardDescription: React.FC> = ({ - className = '', +export const CardDescription = ({ + className = "", children, ...props -}) => { +}: React.ComponentProps) => { return ( -

{children} -

+ ); }; -// 4. CardContent: Mapeado a CardBody de HeroUI -export const CardContent: React.FC> = ({ - className = '', +export const CardContent = ({ + className = "", children, ...props -}) => { +}: React.ComponentProps) => { return ( -
+ {children} -
+ ); }; -export interface CardFooterProps extends React.HTMLAttributes { +export interface CardFooterProps + extends React.ComponentProps { bordered?: boolean; } -export const CardFooter: React.FC = ({ +export const CardFooter = ({ bordered = false, - className = '', + className = "", children, ...props -}) => { +}: CardFooterProps) => { return ( - {children} - + ); }; \ No newline at end of file