From 9167d96ac326287b1e34490eadc59fa0e85c5d5d Mon Sep 17 00:00:00 2001 From: Olaleye Blessing Date: Mon, 2 Oct 2023 12:20:29 +0100 Subject: [PATCH] fix: Highlight selected subcategory --- components/SideNavbar/SideNavbarElement.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/components/SideNavbar/SideNavbarElement.tsx b/components/SideNavbar/SideNavbarElement.tsx index aa095f163..0865d3522 100644 --- a/components/SideNavbar/SideNavbarElement.tsx +++ b/components/SideNavbar/SideNavbarElement.tsx @@ -14,17 +14,18 @@ export const SideNavbarElement: FC<{ const { name, url } = subcat const { closeNav } = useContext(GlobalContext) const { handlePageChange, setCurrentPage } = usePagination() - + const path = `/${category}${url}` + return ( { handlePageChange(1) closeNav }} className={`${ - router.asPath === url + router.asPath === path ? 'border-l-4 border-theme-primary text-theme-secondary dark:text-theme-primary ' : 'text-text-secondary dark:text-gray-text' } collapse w-full text-start pl-3 hover:text-theme-secondary dark:hover:text-violet-300