import React, { ComponentProps, DetailedHTMLProps, HTMLAttributes, } from "react"; import { twMerge } from "tailwind-merge"; import Link from "../layout/Link"; type Props = DetailedHTMLProps< HTMLAttributes, HTMLDivElement > & { variant?: "normal"; href?: string; linkProps?: ComponentProps; noHover?: boolean; elRef?: React.RefObject; linkRef?: React.RefObject; }; /** * # General Card * @className twui-card * @className twui-card-link * * @info use the classname `nested-link` to prevent the card from being clickable when * a link (or the target element with this calss) inside the card is clicked. */ export default function Card({ href, variant, linkProps, noHover, elRef, linkRef, ...props }: Props) { const component = (
{props.children}
); if (href) { return ( {component} ); } return component; }