significant refactor
This commit is contained in:
@@ -8,11 +8,12 @@ interface NavLinkProps {
|
||||
href: string;
|
||||
label: string;
|
||||
Icon: Icon;
|
||||
include?: string[];
|
||||
}
|
||||
|
||||
export const NavLink = ({ href, label, Icon }: NavLinkProps) => {
|
||||
export const NavLink = ({ href, label, Icon, include }: NavLinkProps) => {
|
||||
const router = useRouterState();
|
||||
const isActive = useMemo(() => router.location.pathname === href || (router.location.pathname.includes(href) && href !== '/'), [router.location.pathname, href]);
|
||||
const isActive = useMemo(() => (router.location.pathname === href || (router.location.pathname.includes(href) && href !== '/')) || include?.includes(router.location.pathname), [router.location.pathname, href]);
|
||||
|
||||
return (
|
||||
<Box component={Link} to={href}
|
||||
|
||||
@@ -8,6 +8,7 @@ import { useLinks } from "../hooks/use-links";
|
||||
const Navbar = () => {
|
||||
const { user, roles } = useAuth()
|
||||
const isMobile = useIsMobile();
|
||||
|
||||
const links = useLinks(user?.id, roles);
|
||||
|
||||
if (isMobile) return (
|
||||
|
||||
Reference in New Issue
Block a user