File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 1
- import React , { useState } from 'react' ;
2
- import { Link } from 'react-router-dom' ;
1
+ import React , { useState , useEffect } from 'react' ;
2
+ import { Link , useLocation } from 'react-router-dom' ;
3
3
import { getBasePath } from '../utils/basePath' ;
4
4
5
5
const Header = ( ) => {
6
6
const basePath = getBasePath ( ) ;
7
7
const [ menuOpen , setMenuOpen ] = useState ( false ) ;
8
+ const location = useLocation ( ) ;
8
9
9
10
const openMenu = ( ) => {
10
11
setMenuOpen ( true ) ;
@@ -14,6 +15,10 @@ const Header = () => {
14
15
setMenuOpen ( false ) ;
15
16
} ;
16
17
18
+ useEffect ( ( ) => {
19
+ closeMenu ( ) ;
20
+ } , [ location . pathname ] ) ;
21
+
17
22
return (
18
23
< div className = "relative" >
19
24
< header className = "flex flex-row justify-between items-center bg-background-header px-6 md:px-12 h-[60px] md:h-20 w-full shadow-lg fixed top-0 left-0 z-10" >
You can’t perform that action at this time.
0 commit comments