import type { AnchorHTMLAttributes } from 'react';
import { cn } from '@/utils/cn';

type ExternalLinkProps = Omit<
  AnchorHTMLAttributes<HTMLAnchorElement>,
  'href' | 'rel' | 'target'
> & {
  href: string;
};

export function ExternalLink({ className, ...props }: ExternalLinkProps) {
  return (
    <a
      {...props}
      className={cn(className, 'hover:underline focus:underline')}
      target="_blank"
      rel="noopener noreferrer"
    />
  );
}
