import Image from "next/image"; import Link from "next/link"; import { useRouter } from "next/router"; import { UrlObject } from "url"; export interface NavigationItemProps { text: string; iconUrl?: string; href: string; } export function NavigationItem({ text, iconUrl, href }: NavigationItemProps) { const router = useRouter(); let active = false; if (href === "/" && router.pathname === "/") active = true; if (href !== "/" && router.pathname.startsWith(href)) active = true; return (
  • {iconUrl && } {text}
  • ); }