upstream #1
@ -1,16 +1,13 @@
|
|||||||
/* eslint-disable jsx-a11y/anchor-has-content */
|
/* eslint-disable jsx-a11y/anchor-has-content */
|
||||||
import Link from 'next/link'
|
import Link from 'next/link'
|
||||||
import { AnchorHTMLAttributes, DetailedHTMLProps } from 'react'
|
import type { LinkProps } from 'next/link'
|
||||||
|
import { AnchorHTMLAttributes } from 'react'
|
||||||
|
|
||||||
const CustomLink = async ({
|
const CustomLink = ({ href, ...rest }: LinkProps & AnchorHTMLAttributes<HTMLAnchorElement>) => {
|
||||||
href,
|
|
||||||
...rest
|
|
||||||
}: DetailedHTMLProps<AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>) => {
|
|
||||||
const isInternalLink = href && href.startsWith('/')
|
const isInternalLink = href && href.startsWith('/')
|
||||||
const isAnchorLink = href && href.startsWith('#')
|
const isAnchorLink = href && href.startsWith('#')
|
||||||
|
|
||||||
if (isInternalLink) {
|
if (isInternalLink) {
|
||||||
// @ts-ignore
|
|
||||||
return <Link href={href} {...rest} />
|
return <Link href={href} {...rest} />
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user