import * as React from "react" import clsx from 'clsx' import { useRouter } from 'next/router' import NextLink from 'next/link' import MuiLink from '@mui/material/Link' export const NextLinkComposed = React.forwardRef(function NextLinkComposed(props: any, ref) { const { to, linkAs, href, replace, scroll, passHref, shallow, prefetch, locale, ...other } = props return ( ) }) // A styled version of the Next.js Link component: // https://nextjs.org/docs/#with-link const Link = React.forwardRef(function Link(props: any, ref) { const { activeClassName = "active", as: linkAs, className: classNameProps, href, noLinkStyle, role, // Links don't have roles. ...other } = props const router = useRouter() const pathname: string = typeof href === "string" ? href : href.pathname const className = clsx(classNameProps, { [activeClassName]: router.pathname === pathname && activeClassName, }) const isExternal: boolean = typeof href === "string" && (href.indexOf('http') === 0 || href.indexOf('mailto:') === 0) if (isExternal) { if (noLinkStyle) { return } return } if (noLinkStyle) { return } return ( ) }) export default Link