From a453147e9e9b3d92240712afd5089223c713b70e Mon Sep 17 00:00:00 2001 From: Carter Date: Mon, 18 Nov 2024 11:01:33 -0600 Subject: [PATCH] using location hook to properly update render so it highlights the correct button after it's pressed based on url --- src/navigation/SideNavigator.tsx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/navigation/SideNavigator.tsx b/src/navigation/SideNavigator.tsx index 39d35bc..659e00b 100644 --- a/src/navigation/SideNavigator.tsx +++ b/src/navigation/SideNavigator.tsx @@ -5,7 +5,7 @@ import classNames from "classnames"; import { useWidth } from "../hooks/useWidth"; import { makeStyles } from "@mui/styles"; import BindaptIcon from "../products/Bindapt/BindaptIcon"; -import { Link } from "react-router-dom"; +import { Link, useLocation } from "react-router-dom"; const drawerWidth = 230; @@ -78,6 +78,7 @@ export default function SideNavigator(props: Props) { const theme = useTheme(); const width = useWidth(); const classes = useStyles(); + const location = useLocation(); const getClasses = (page: string) => { if (page === "/device") { @@ -105,8 +106,8 @@ export default function SideNavigator(props: Props) { @@ -122,12 +123,12 @@ export default function SideNavigator(props: Props) { component={Link} to="/teams" onClick={onClose} - classes={getClasses("/device")} + classes={getClasses("/team")} > - {open && } + {open && }