feat(frontend): side-nav show what tab the user is in
This commit is contained in:
parent
ed0deed5a3
commit
fa047e5e51
|
|
@ -24,6 +24,19 @@ export const SideNav = (props) => {
|
||||||
const pathname = usePathname();
|
const pathname = usePathname();
|
||||||
const lgUp = useMediaQuery((theme) => theme.breakpoints.up('lg'));
|
const lgUp = useMediaQuery((theme) => theme.breakpoints.up('lg'));
|
||||||
|
|
||||||
|
const isItemActive = (currentPath, itemPath) => {
|
||||||
|
if (currentPath === itemPath) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (currentPath.includes(itemPath) && itemPath !== '/') {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
//TODO: test frontend with color of the landing page
|
||||||
|
}
|
||||||
|
|
||||||
const content = (
|
const content = (
|
||||||
<Scrollbar
|
<Scrollbar
|
||||||
sx={{
|
sx={{
|
||||||
|
|
@ -100,7 +113,7 @@ export const SideNav = (props) => {
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{items.map((item) => {
|
{items.map((item) => {
|
||||||
const active = item.path ? (pathname === item.path) : false;
|
const active = isItemActive(pathname, item.path);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SideNavItem
|
<SideNavItem
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user