import { Flex, Box, Text } from "@mantine/core"; import { Link, useRouterState } from "@tanstack/react-router"; import styles from "./styles.module.css"; import { Icon } from "@phosphor-icons/react"; import { useMemo } from "react"; interface NavLinkProps { href: string; label: string; Icon: Icon; include?: string[]; exclude?: string[]; } export const NavLink = ({ href, label, Icon, include, exclude, }: NavLinkProps) => { const router = useRouterState(); const isActive = useMemo( () => (!exclude?.some((e) => router.location.pathname.includes(e)) && (router.location.pathname === href || (router.location.pathname.includes(href) && href !== "/"))) || include?.includes(router.location.pathname), [router.location.pathname, href] ); return ( {label} ); };