// DocCard + DocCards — grid of clickable cards for docs landing pages // (Fumadocs calls these `` / ``). The wrapper handles the // grid; each card is a Link with a hover indicator. // // Usage: // // // // import type { ComponentType, ReactNode } from 'react' import { cn } from '../cn' import type { ShellLinkProps } from '../compositions/docShell' interface DocCardsProps { readonly children: ReactNode readonly className?: string /** Override the grid columns. Default: 1 on mobile, 2 on md+. */ readonly cols?: 1 | 2 | 3 /** Stagger the first paint — each card fades + slides up with a * ~40ms delay. Respects prefers-reduced-motion. Default true. */ readonly stagger?: boolean } interface DocCardProps { readonly title: ReactNode readonly description?: ReactNode readonly href: string readonly icon?: ReactNode readonly className?: string /** Optional client-router Link; falls back to plain . */ readonly LinkComponent?: ComponentType } const PlainLink = ({ to, className, children }: ShellLinkProps): ReactNode => ( {children} ) const colClass: Record, string> = { 1: 'grid-cols-1', 2: 'grid-cols-1 md:grid-cols-2', 3: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3', } export const DocCards = ({ children, className, cols = 2, stagger = true, }: DocCardsProps): ReactNode => (
{children}
) export const DocCard = ({ title, description, href, icon, className, LinkComponent = PlainLink, }: DocCardProps): ReactNode => { const Link = LinkComponent return (
{icon ? ( ) : null}
{title}
{description ? (
{description}
) : null} ) }