From aa2fcfa2da47fef7ef57ec5a9cfb3f2b26e70e71 Mon Sep 17 00:00:00 2001 From: Nicolly Vieira Date: Sat, 7 Jan 2023 14:41:49 -0300 Subject: [PATCH] fix(HeaderBotom): Conserta o overflow hidden do menu --- .../src/components/Header/Header.tsx | 24 +++++++++---------- .../components/HeaderBottom.module.scss | 1 + 2 files changed, 13 insertions(+), 12 deletions(-) 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; -- 2.34.1