import { Icon, Row, Text } from '@umami/react-zen'; import Link from 'next/link'; import { type HTMLAttributes, type ReactNode, useState } from 'react'; import { useMessages, useNavigation } from '@/components/hooks'; import { ExternalLink } from '@/components/icons'; export interface FilterLinkProps extends HTMLAttributes { type: string; value: string; label?: string; icon?: ReactNode; externalUrl?: string; } export function FilterLink({ type, value, label, externalUrl, icon }: FilterLinkProps) { const [showLink, setShowLink] = useState(false); const { formatMessage, labels } = useMessages(); const { updateParams, query } = useNavigation(); const active = query[type] !== undefined; const selected = query[type] === value; return ( setShowLink(true)} onMouseOut={() => setShowLink(false)} > {icon} {!value && `(${label || formatMessage(labels.unknown)})`} {value && ( {label || value} )} {externalUrl && showLink && ( )} ); }