import React, { type MouseEventHandler } from 'react'; import { classNames } from '../../utils'; import { Icon } from '../Icon'; import styles from './Anchor.module.css'; export type AnchorVariant = 'primary' | 'secondary'; export interface AnchorProps extends React.AnchorHTMLAttributes { /** * A string representation of the Anchor location */ href: string; /** * Whether the link should be open in new tab */ isExternal?: boolean; /** * The visual style of the Anchor */ variant?: AnchorVariant; /** * Handler called when the Link is clicked */ onClick?: MouseEventHandler; } /** * Anchor allow users to navigate to a different location */ export function Anchor({ href, isExternal, children, className, variant, onClick, ...rest }: AnchorProps) { const anchorAttributs = isExternal ? { target: '_blank', rel: 'noopener noreferrer' } : undefined; return ( {children} {isExternal && } ); }