diff --git a/desafio-react-typescript/src/components/Header/Header.tsx b/desafio-react-typescript/src/components/Header/Header.tsx index 72b1705..1319160 100644 --- a/desafio-react-typescript/src/components/Header/Header.tsx +++ b/desafio-react-typescript/src/components/Header/Header.tsx @@ -6,21 +6,21 @@ import styles from "./Header.module.scss"; const Header = () => { const [isOpen, setIsOpen] = useState(false); - const resizeWindow = () => { - window.addEventListener("resize", () => { - if(window.innerWidth > 1024) { - document.body.style.overflowY = "auto"; - - } - }); - }; - useEffect(() => { - resizeWindow(); - }) + window.addEventListener("resize", () => { + if (window.innerWidth > 1024) { + document.body.style.overflowY = "auto"; + } + if (window.innerWidth <= 1024 && isOpen) { + document.body.style.overflowY = "hidden"; + } else { + document.body.style.overflowY = "auto"; + } + }); + }); return ( -
+
diff --git a/desafio-react-typescript/src/components/Header/components/HeaderBottom.module.scss b/desafio-react-typescript/src/components/Header/components/HeaderBottom.module.scss index 426bc20..3a9ba74 100644 --- a/desafio-react-typescript/src/components/Header/components/HeaderBottom.module.scss +++ b/desafio-react-typescript/src/components/Header/components/HeaderBottom.module.scss @@ -5,6 +5,7 @@ background: $black; padding: 14px 100px; + z-index: 20; @include mq($lg, max) { position: absolute;