1
- import React from "react" ;
1
+ import React , { useEffect } from "react" ;
2
2
import { Button } from "./ui/button" ;
3
- import { ArrowRightFromLine , ChevronDown } from "lucide-react" ;
3
+ import { ArrowRightFromLine } from "lucide-react" ;
4
4
import { Link , useLocation } from "react-router-dom" ;
5
5
6
-
7
-
8
-
9
6
const Navbar = ( ) => {
10
7
const location = useLocation ( ) ;
8
+
9
+ useEffect ( ( ) => {
10
+ // Remove focus/highlight from any active element when location changes
11
+ if ( document . activeElement ) {
12
+ document . activeElement . blur ( ) ;
13
+ }
14
+ } , [ location ] ) ;
15
+
11
16
return (
12
- < div className = "px-[5vw] py-2 w-full flex justify-between items-center bg-green-900 text-white text-xl gap-5 z-10 sticky top-0 left-0 h-16" >
17
+ < div className = "px-[5vw] py-2 w-full flex justify-between items-center bg-green-900 text-white text-xl gap-5 z-10 sticky top-0 left-0 h-16" >
13
18
< div className = "flex gap-5" >
14
19
< Link to = "/" >
15
20
< p > Home</ p >
@@ -24,19 +29,14 @@ const Navbar = () => {
24
29
< p > Contact Us</ p >
25
30
</ div >
26
31
< div className = "flex gap-4" >
27
- { location . pathname === "/login" ||
28
- location . pathname === "/userlogin" ? (
29
- < > </ >
30
- ) : (
32
+ { location . pathname !== "/login" && location . pathname !== "/userlogin" && (
31
33
< Link to = "/login" >
32
34
< Button className = "gap-2 px-5 text-xl bg-green-500 hover:bg-white hover:text-black" >
33
35
LOGIN < ArrowRightFromLine />
34
36
</ Button >
35
37
</ Link >
36
38
) }
37
- { location . pathname === "/register" ? (
38
- < > </ >
39
- ) : (
39
+ { location . pathname !== "/register" && (
40
40
< Link to = "/register" >
41
41
< Button className = "text-xl bg-transparent hover:bg-white hover:text-black" >
42
42
REGISTER
0 commit comments