File tree 1 file changed +7
-5
lines changed
1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,8 @@ import React, { useState } from "react";
2
2
import styled , { css } from "styled-components" ;
3
3
import HamburgerIcon from "svgs/header/hamburger.svg" ;
4
4
5
+ import { useLockBodyScroll } from "react-use" ;
6
+
5
7
import { landscapeStyle } from "styles/landscapeStyle" ;
6
8
7
9
import LightButton from "components/LightButton" ;
@@ -34,17 +36,18 @@ const StyledLightButton = styled(LightButton)`
34
36
}
35
37
` ;
36
38
37
- const Overlay = styled . div < { isOpen : boolean } > `
38
- display: ${ ( { isOpen } ) => ( isOpen ? "block" : "none" ) } ;
39
- position: absolute;
39
+ const Overlay = styled . div `
40
+ position: fixed;
40
41
top: 0;
41
- width: 100vw;
42
+ left: 0;
43
+ width: 100%;
42
44
height: 64px;
43
45
z-index: 1;
44
46
` ;
45
47
46
48
const MobileHeader = ( ) => {
47
49
const [ isOpen , setIsOpen ] = useState ( false ) ;
50
+ useLockBodyScroll ( isOpen ) ;
48
51
49
52
const handleOpenNavbar = ( ) => {
50
53
setIsOpen ( true ) ;
@@ -57,7 +60,6 @@ const MobileHeader = () => {
57
60
return (
58
61
< Container >
59
62
{ isOpen ? < Overlay { ...{ isOpen } } onClick = { handleCloseNavbar } /> : null }
60
-
61
63
< Logo />
62
64
< StyledLightButton text = "" Icon = { HamburgerIcon } onClick = { handleOpenNavbar } />
63
65
< NavBar { ...{ isOpen, handleCloseNavbar } } />
You can’t perform that action at this time.
0 commit comments