@@ -5,12 +5,11 @@ import {
5
5
XMarkIcon ,
6
6
HomeIcon ,
7
7
BriefcaseIcon ,
8
- DocumentTextIcon ,
9
- BookmarkIcon ,
10
8
ChatBubbleLeftRightIcon ,
11
9
UserIcon ,
12
10
Cog8ToothIcon ,
13
11
ArrowLeftStartOnRectangleIcon ,
12
+ BookmarkIcon ,
14
13
} from "@heroicons/react/24/outline" ;
15
14
import { Dialog , Menu , Transition } from "@headlessui/react" ;
16
15
import { useAuth } from "@/providers" ;
@@ -24,11 +23,10 @@ const Header = () => {
24
23
const navigation = useMemo ( ( ) => {
25
24
if ( isAuthenticated ) {
26
25
return [
27
- { name : "Home" , href : "#" , icon : HomeIcon } ,
28
- { name : "Find Jobs" , href : "#" , icon : BriefcaseIcon } ,
29
- { name : "My Jobs" , href : "#" , icon : DocumentTextIcon } ,
30
- { name : "Saved Jobs" , href : "#" , icon : BookmarkIcon } ,
31
- { name : "Messages" , href : "#" , icon : ChatBubbleLeftRightIcon } ,
26
+ { name : "Home" , href : "/" , icon : HomeIcon } ,
27
+ { name : "My Jobs" , href : "/my-jobs" , icon : BriefcaseIcon } ,
28
+ { name : "Saved Jobs" , href : "/saved-jobs" , icon : BookmarkIcon } ,
29
+ { name : "Messages" , href : "/messages" , icon : ChatBubbleLeftRightIcon } ,
32
30
] ;
33
31
}
34
32
@@ -56,14 +54,18 @@ const Header = () => {
56
54
</ div >
57
55
< div className = "hidden lg:flex lg:gap-x-12" >
58
56
{ navigation . map ( ( item ) => (
59
- < a
57
+ < Link
60
58
key = { item . name }
61
- href = { item . href }
62
- className = "text-sm font-semibold leading-6 text-gray-900 flex items-center gap-x-2"
59
+ to = { item . href }
60
+ className = { `text-sm font-semibold leading-6 text-gray-900 flex items-center gap-x-2 ${
61
+ window . location . pathname === item . href
62
+ ? "text-indigo-600"
63
+ : "hover:text-indigo-600"
64
+ } `}
63
65
>
64
66
{ item . icon && < item . icon className = "h-6 w-6" /> }
65
67
{ item . name }
66
- </ a >
68
+ </ Link >
67
69
) ) }
68
70
</ div >
69
71
{ isAuthenticated ? (
@@ -191,14 +193,10 @@ const Header = () => {
191
193
< div className = "fixed inset-0 z-10" />
192
194
< Dialog . Panel className = "fixed inset-y-0 right-0 z-10 w-full overflow-y-auto bg-white px-6 py-6 sm:max-w-sm sm:ring-1 sm:ring-gray-900/10" >
193
195
< div className = "flex items-center justify-between" >
194
- < a href = "#" className = "-m-1.5 p-1.5" >
195
- < span className = "sr-only" > Your Company</ span >
196
- < img
197
- className = "h-8 w-auto"
198
- src = "https://tailwindui.com/img/logos/mark.svg?color=indigo& shade = 600 "
199
- alt = ""
200
- />
201
- </ a >
196
+ < div className = "-m-1.5 p-1.5" >
197
+ < span className = "sr-only" > JobPortal</ span >
198
+ < Logo />
199
+ </ div >
202
200
< button
203
201
type = "button"
204
202
className = "-m-2.5 rounded-md p-2.5 text-gray-700"
@@ -210,24 +208,60 @@ const Header = () => {
210
208
</ div >
211
209
< div className = "mt-6 flow-root" >
212
210
< div className = "-my-6 divide-y divide-gray-500/10" >
213
- < div className = "space-y-2 py-6 " >
211
+ < div className = "" >
214
212
{ navigation . map ( ( item ) => (
215
- < a
213
+ < Link
216
214
key = { item . name }
217
- href = { item . href }
218
- className = "-mx-3 block rounded-lg px-3 py-2 text-base font-semibold leading-7 text-gray-900 hover:bg-gray-50"
215
+ to = { item . href }
216
+ className = { `-mx-3 block rounded-lg px-3 py-2 text-base font-semibold leading-7 text-gray-900 hover:bg-gray-50 ${
217
+ window . location . pathname === item . href
218
+ ? "text-indigo-600"
219
+ : ""
220
+ } `}
219
221
>
220
222
{ item . name }
221
- </ a >
223
+ </ Link >
222
224
) ) }
223
225
</ div >
224
226
< div className = "py-6" >
225
- < a
226
- href = "#"
227
- className = "-mx-3 block rounded-lg px-3 py-2.5 text-base font-semibold leading-7 text-gray-900 hover:bg-gray-50"
228
- >
229
- Log in
230
- </ a >
227
+ { ! isAuthenticated ? (
228
+ < >
229
+ < Link
230
+ to = "/login"
231
+ className = "-mx-3 block rounded-lg px-3 py-2.5 text-base font-semibold leading-7 text-gray-900 hover:bg-gray-50"
232
+ >
233
+ Log in
234
+ </ Link >
235
+ < Link
236
+ to = "/register"
237
+ className = "-mx-3 block rounded-lg px-3 py-2.5 text-base font-semibold leading-7 text-gray-900 hover:bg-gray-50"
238
+ >
239
+ Sign up
240
+ </ Link >
241
+ </ >
242
+ ) : (
243
+ < >
244
+ < Link
245
+ to = "/profile"
246
+ className = "-mx-3 block rounded-lg px-3 py-2.5 text-base font-semibold leading-7 text-gray-900 hover:bg-gray-50"
247
+ >
248
+ Profile
249
+ </ Link >
250
+ < Link
251
+ to = "/register"
252
+ className = "-mx-3 block rounded-lg px-3 py-2.5 text-base font-semibold leading-7 text-gray-900 hover:bg-gray-50"
253
+ >
254
+ Settings
255
+ </ Link >
256
+ < Link
257
+ to = "/"
258
+ className = "-mx-3 block rounded-lg px-3 py-2.5 text-base font-semibold leading-7 text-gray-900 hover:bg-gray-50"
259
+ onClick = { logout }
260
+ >
261
+ Sign out
262
+ </ Link >
263
+ </ >
264
+ ) }
231
265
</ div >
232
266
</ div >
233
267
</ div >
0 commit comments