Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | 1x 1x 376x 376x 376x 1x 1x 1x 371x 376x 376x | import { FC, PropsWithChildren } from 'react'
import Link from 'next/link'
export interface OptionalLinkWrapperProps {
href?: string
newTab?: boolean
}
export const OptionalLinkWrapper: FC<PropsWithChildren<OptionalLinkWrapperProps>> = ({ children, href, newTab }) => {
return (
<>
{href ? (
<Link href={href}>
<a {...(newTab && { target: '_blank', rel: 'noreferrer noopener' })}>{children}</a>
</Link>
) : (
children
)}
</>
)
}
|