diff --git a/src/components/ui/Card.tsx b/src/components/ui/Card.tsx index e823933..733e69a 100644 --- a/src/components/ui/Card.tsx +++ b/src/components/ui/Card.tsx @@ -1,25 +1,50 @@ import React from 'react' import clsx from 'clsx' +/* ── Card Root ──────────────────────────────────────────────────────────────── */ interface CardProps extends React.HTMLAttributes { - hover?: boolean + hover?: boolean padding?: 'none' | 'sm' | 'md' | 'lg' + as?: React.ElementType } -const paddingClasses = { - none: '', - sm: 'p-4', - md: 'p-5', - lg: 'p-6', -} +export const Card = React.forwardRef( + ({ hover = false, padding = 'none', as: Tag = 'div', className, children, ...props }, ref) => { + const paddingClasses = { + none: '', + sm: 'p-4', + md: 'p-5', + lg: 'p-6', + } -export function Card({ hover, padding = 'md', className, children, ...props }: CardProps) { + return ( + + {children} + + ) + }, +) +Card.displayName = 'Card' + +/* ── Card Header ────────────────────────────────────────────────────────────── */ +interface CardHeaderProps extends React.HTMLAttributes { + border?: boolean +} +export function CardHeader({ border = true, className, children, ...props }: CardHeaderProps) { return (
) { +/* ── Card Body ──────────────────────────────────────────────────────────────── */ +export function CardBody({ className, children, ...props }: React.HTMLAttributes) { return ( -
+
{children}
) } +/* ── Card Footer ────────────────────────────────────────────────────────────── */ +interface CardFooterProps extends React.HTMLAttributes { + border?: boolean +} +export function CardFooter({ border = true, className, children, ...props }: CardFooterProps) { + return ( +
+ {children} +
+ ) +} + +/* ── Card Title ─────────────────────────────────────────────────────────────── */ export function CardTitle({ className, children, ...props }: React.HTMLAttributes) { return ( -

+

{children}

) } +/* ── Card Description ───────────────────────────────────────────────────────── */ export function CardDescription({ className, children, ...props }: React.HTMLAttributes) { return ( -

+

{children}

) } -export function CardFooter({ className, children, ...props }: React.HTMLAttributes) { - return ( -
- {children} -
- ) -} +export default Card