import Link from 'next/link';
import { ReactNode } from 'react';
import Badge from './Badge';
import { clsx } from 'clsx/lite';
export interface EntityLinkExternalProps {
type?: 'icon-last' | 'icon-first' | 'icon-only' | 'text-only'
badged?: boolean
contrast?: 'low' | 'medium' | 'high'
}
export default function EntityLink({
label,
labelSmall,
href,
icon,
title,
type = 'icon-first',
badged,
contrast,
hoverEntity,
}: {
label: ReactNode
labelSmall?: ReactNode
href: string
icon?: ReactNode
title?: string
hoverEntity?: ReactNode
} & EntityLinkExternalProps) {
const renderLabel = () => <>
{labelSmall ?? label}
{label}
>;
return (
{type !== 'icon-only' && <>
{badged
?
{renderLabel()}
:
{renderLabel()}
}
>}
{icon && type !== 'text-only' &&
{icon}
}
{hoverEntity !== undefined &&
{hoverEntity}
}
);
}