import classNames from 'classnames'; import type { HTMLAttributes } from 'react'; import { Link as RouterLink } from '@tanstack/react-router'; import { trackEvent } from '../../lib/analytics'; import { Icon } from './Icon'; interface Props extends HTMLAttributes { href: string; event?: string; } export function Link({ href, children, className, event, ...other }: Props) { const isExternal = href.match(/^https?:\/\//); className = classNames(className, 'relative underline hover:text-violet-600'); if (isExternal) { return ( { e.preventDefault(); if (event != null) { trackEvent('link', 'click', { id: event }); } }} {...other} > {children} ); } return ( {children} ); } export function FeedbackLink() { return Feedback; }