import { type ComponentProps, type CSSProperties, type ReactNode } from 'react'; import { Link } from '../../provider.js'; import clsx from 'clsx'; import styles from './styles.module.css'; export type BaseCardProps = { as?: 'div' | 'article' | 'section'; children: ReactNode; padding?: CSSProperties['padding']; style?: CSSProperties; className?: string; wrapperClassName?: string; }; export type StaticCardProps = BaseCardProps & { to?: never; href?: never; }; export type LinkedCardProps = BaseCardProps & Omit, 'children' | 'className' | 'style'> & ( | { to: string; href?: never; } | { href: string; to?: never; } ); export type CardProps = StaticCardProps | LinkedCardProps; function CardSurface({ as: Tag = 'div', children, padding, style, className, }: Pick) { return ( {children} ); } export default function Card({ as, children, padding, style, className, wrapperClassName, ...linkProps }: CardProps) { if (!('to' in linkProps) && !('href' in linkProps)) { return ( {children} ); } return ( {children} ); }