11import { useState , useRef , useEffect , Fragment } from "react" ;
22// import { useState, Fragment } from "react";
33import accountLogo from "../../assets/account.svg" ;
4- import { Link , useNavigate } from "react-router-dom" ;
4+ import { Link , useNavigate , useLocation } from "react-router-dom" ;
55import LoginMenuDropDown from "./LoginMenuDropDown" ;
66import "../../components/Header/header.css" ;
77import Chat from "./Chat" ;
@@ -98,6 +98,9 @@ const Header: React.FC<LoginFormProps> = ({
9898 navigate ( "/" ) ;
9999 } ;
100100
101+ const location = useLocation ( ) ;
102+ const currentPath = location . pathname ;
103+
101104 return (
102105 < header className = "z-50 fixed w-full items-center no-print" >
103106 < div className = "hidden w-full items-center justify-center border-b border-gray-300 bg-blue-100 p-1 text-center text-sm font-light text-gray-500 lg:flex" >
@@ -136,38 +139,38 @@ const Header: React.FC<LoginFormProps> = ({
136139 < Link
137140 to = "/"
138141 onClick = { ( ) => handleForm ( ) }
139- className = " text-black hover:border-blue-600 hover:text-blue-600 hover:no-underline"
142+ className = { currentPath === "/" ? "header-nav-item header-nav-item-selected" : "header-nav-item" }
140143 >
141144 Medication Suggester
142145 </ Link >
143146 < >
144147 < Link
145148 to = "/medications"
146- className = " text-black hover:border-blue-600 hover:text-blue-600 hover:no-underline"
149+ className = { currentPath === "/medications" ? "header-nav-item header-nav-item-selected" : "header-nav-item" }
147150 >
148151 Medication List
149152 </ Link >
150153 < Link
151154 to = "/about"
152- className = " text-black hover:border-blue-600 hover:text-blue-600 hover:no-underline"
155+ className = { currentPath === "/about" ? "header-nav-item header-nav-item-selected" : "header-nav-item" }
153156 >
154157 About
155158 </ Link >
156159 < Link
157160 to = "/help"
158- className = " text-black hover:border-blue-600 hover:text-blue-600 hover:no-underline"
161+ className = { currentPath === "/help" ? "header-nav-item header-nav-item-selected" : "header-nav-item" }
159162 >
160163 Help
161164 </ Link >
162165 < Link
163166 to = "/feedback"
164- className = " text-black hover:border-blue-600 hover:text-blue-600 hover:no-underline"
167+ className = { currentPath === "/feedback" ? "header-nav-item header-nav-item-selected" : "header-nav-item" }
165168 >
166169 Leave Feedback
167170 </ Link >
168171 < a href = "https://www.flipcause.com/secure/cause_pdetails/MjMyMTIw"
169172 target = "_blank"
170- className = "text-black hover:border-blue-600 hover:text-blue-600 hover:no-underline "
173+ className = "header-nav-item "
171174 >
172175 Donate
173176 </ a >
@@ -179,11 +182,12 @@ const Header: React.FC<LoginFormProps> = ({
179182 className = ""
180183 >
181184 < span
182- className = { ` text-black ${
183- showFeaturesMenu
184- ? "cursor-pointer border-b-2 border-blue-600 hover:border-b-2 hover:border-blue-600 hover:text-blue-600 hover:no-underline"
185- : "cursor-pointer hover:border-b-2 hover:border-blue-600 hover:text-black hover:no-underline"
186- } `}
185+ className = { `header-nav-item ${
186+ showFeaturesMenu && "text-blue-600"
187+ } ${
188+ ( currentPath === "/rulesmanager" || currentPath === "/ManageMeds" ) && "header-nav-item-selected"
189+ } `
190+ }
187191 >
188192 Admin Portal
189193 < span
@@ -224,4 +228,4 @@ const mapStateToProps = (state: RootState) => ({
224228} ) ;
225229
226230const ConnectedLayout = connect ( mapStateToProps ) ( Header ) ;
227- export default ConnectedLayout ;
231+ export default ConnectedLayout ;
0 commit comments