29 lines
1023 B
TypeScript
29 lines
1023 B
TypeScript
import type { ComponentProps } from 'react';
|
|
import { cva, type VariantProps } from 'class-variance-authority';
|
|
import { cn } from '~/lib/utils';
|
|
|
|
const cardVariants = cva('text-text-primary ring-1 ring-inset', {
|
|
variants: {
|
|
surface: {
|
|
default: 'bg-surface ring-border-subtle',
|
|
well: 'bg-surface-well ring-border-divider',
|
|
},
|
|
size: {
|
|
sm: 'rounded-card-sm',
|
|
md: 'rounded-card',
|
|
lg: 'rounded-panel',
|
|
},
|
|
interactive: {
|
|
true: 'cursor-pointer transition-shadow duration-150 hover:ring-border-strong',
|
|
false: '',
|
|
},
|
|
},
|
|
defaultVariants: { surface: 'default', size: 'md', interactive: false },
|
|
});
|
|
|
|
export interface CardProps extends ComponentProps<'div'>, VariantProps<typeof cardVariants> {}
|
|
|
|
export function Card({ className, surface, size, interactive, ...props }: CardProps) {
|
|
return <div className={cn(cardVariants({ surface, size, interactive }), className)} {...props} />;
|
|
}
|