import NavLink from 'next/link' import { useRouter } from 'next/router' import { Link as ScrollLink } from 'react-scroll' import { pageview } from './gtag' import { useIntl } from 'react-intl' interface NavLinksProps { onClick?: () => void } interface LinkProps { href: string to: string } const NavLinks = ({ onClick }: NavLinksProps): JSX.Element => { const { pathname } = useRouter() const intl = useIntl() const className = 'dark:text-gray-300' const path = (href: string) => { const hashIndex = href.indexOf('#') if (hashIndex < 0) return href return href.substring(0, hashIndex) } const Link: React.FC = ({ href, to, children }) => { return path(href) === pathname ? ( { pageview(href) onClick?.() }} > {children} ) : ( onClick?.()}> {children} ) } return ( ) } export default NavLinks