Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions src/components/Card.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { forwardRef, type HTMLAttributes } from 'react';

type CardVariant = 'default' | 'glass' | 'outlined';

export type CardProps = HTMLAttributes<HTMLDivElement> & {
/** Visual style variant */
variant?: CardVariant;
/** Enable hover lift effect */
interactive?: boolean;
/** Additional CSS classes */
className?: string;
};

const variantClasses: Record<CardVariant, string> = {
default: 'bg-bg-surface-raised border border-border-subtle shadow-elevation-raised',
glass: ['bg-bg-surface-default/[0.03] border border-border-subtle/50', 'backdrop-blur-xl'].join(
' ',
),
outlined: 'bg-transparent border border-border-subtle',
};

export const Card = forwardRef<HTMLDivElement, CardProps>(
({ variant = 'default', interactive = false, className = '', children, ...props }, ref) => {
const classes = [
'rounded-2xl p-6',
'transition-all duration-250 ease-out',
variantClasses[variant],
interactive
? 'hover:-translate-y-1 hover:shadow-elevation-overlay hover:border-border-strong cursor-pointer'
: '',
className,
]
.filter(Boolean)
.join(' ');

return (
<div ref={ref} className={classes} {...props}>
{children}
</div>
);
},
);

Card.displayName = 'Card';
1 change: 1 addition & 0 deletions src/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export { Button, type ButtonProps } from './Button';
export { Badge, type BadgeProps } from './Badge';
export { Text, type TextProps } from './Text';
export { Card, type CardProps } from './Card';