import Link from 'next/link' import type { ReactNode } from 'react' type CommonProps = { num: string title: string description: string type: string featured?: boolean visual?: ReactNode } type InternalProps = CommonProps & { to: string; href?: never; external?: false } type ExternalProps = CommonProps & { href: string; to?: never; external?: true } type Props = InternalProps | ExternalProps /** * Project card on /resources. Behaves as either an internal next/link * (when `to` is set) or an external anchor with target=_blank (when * `href` is set). Featured cards span full width with the visual on the * right; non-featured render with a small icon in the top-right corner. */ export function ProjectCard(props: Props) { const { num, title, description, type, featured = false, visual } = props const hasIcon = visual && !featured const body = ( <> {hasIcon && {visual}}
{num}

{title}

{description}

{type} {'external' in props && props.external ? ( ) : ( )}
{featured && visual &&
{visual}
} ) const className = `resources-card${featured ? ' resources-card-featured' : ''}${hasIcon ? ' resources-card-has-icon' : ''}` if ('to' in props && props.to) { return ( {body} ) } return ( {body} ) }