(props: Props)
| 5 | |
| 6 | type Props = { locale?: string; disableClientTransition?: boolean } & ComponentProps<'a'> |
| 7 | export function Link(props: Props) { |
| 8 | const { href, locale, disableClientTransition = false, ...restProps } = props |
| 9 | |
| 10 | if (!href && NODE_ENV !== 'production') { |
| 11 | console.warn('Missing href on Link') |
| 12 | } |
| 13 | |
| 14 | const isExternal = href?.startsWith('http') || href?.startsWith('//') |
| 15 | |
| 16 | if (disableClientTransition) { |
| 17 | return ( |
| 18 | /* eslint-disable-next-line jsx-a11y/anchor-has-content */ |
| 19 | <a |
| 20 | href={locale ? `/${locale}${href}` : href} |
| 21 | rel={isExternal ? 'noopener' : ''} |
| 22 | {...restProps} |
| 23 | /> |
| 24 | ) |
| 25 | } |
| 26 | |
| 27 | return ( |
| 28 | <NextLink href={locale ? `/${locale}${href}` : href || ''} locale={locale || false}> |
| 29 | {/* eslint-disable-next-line jsx-a11y/anchor-has-content */} |
| 30 | <a rel={isExternal ? 'noopener' : ''} {...restProps} /> |
| 31 | </NextLink> |
| 32 | ) |
| 33 | } |
nothing calls this directly
no outgoing calls
no test coverage detected