Skip to content

Commit 9a1de27

Browse files
committed
card
1 parent 009358b commit 9a1de27

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

packages/primitives/src/Card.tsx

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,24 @@
11
import { clsx } from 'clsx';
22
import { forwardRef } from 'react';
33

4-
const Card = forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
5-
({ className, ...props }, ref) => (
4+
type CardVariant = 'default' | 'dark';
5+
6+
const variantStyles: Record<CardVariant, string> = {
7+
default: 'bg-app-box',
8+
dark: 'bg-app-dark-box',
9+
};
10+
11+
interface CardProps extends React.HTMLAttributes<HTMLDivElement> {
12+
variant?: CardVariant;
13+
}
14+
15+
const Card = forwardRef<HTMLDivElement, CardProps>(
16+
({ className, variant = 'default', ...props }, ref) => (
617
<div
718
ref={ref}
819
className={clsx(
9-
'rounded-lg border border-app-line bg-app-box text-ink shadow-sm',
20+
'rounded-lg border border-app-line text-ink shadow-sm',
21+
variantStyles[variant],
1022
className
1123
)}
1224
{...props}

0 commit comments

Comments
 (0)