import React, { useMemo } from "react"; import { externalIcon } from '../../assets/icons' import { StyledLink } from './link.styled' interface LinkProps { href: string; children: React.ReactNode; contrast?: boolean; inheritColor?: boolean; } export const Link = (props: LinkProps) => { const isExternal = useMemo(() => props.href?.startsWith('http'), [props.href]); const linkProps: any = {} if (isExternal) { linkProps.target = '_blank' linkProps.rel = 'noopener noreferrer' } return ( {props.children} {isExternal && external link icon} ); }; Link.defaultProps = { contrast: false, inheritColor: false, }