import Link from "next/link" import { navLinkStyle } from "./Styles" import { useRouter } from "next/router" const nav = [ { name: "Posts", slug: "post", }, { name: "Lists", slug: "list", }, ] const projects = [ { name: "Design Docs", slug: "design-docs", url: "https://designdocs.co/", }, ] const social = [ { name: "Github", url: "https://github.com/iamnbutler/", }, { name: "Twitter", url: "https://twitter.com/iamnbutler", }, { name: "Read.cv", url: "https://read.cv/natebutler", }, ] interface NavLink { name: string slug?: string url?: string } interface NavLinkItemProps { link: NavLink } /** * Build nav link items. * If a `url` isn't passed, use `slug` to create an link **/ function NavLinkItem({ link }: NavLinkItemProps) { let href = "" link.url ? (href = link.url) : (href = `/${link.slug}`) let current = false let currentPath = useRouter().asPath if (currentPath.includes(href)) { current = true } return ( {link.name} ) } export default function Navigation() { return ( ) }