From 889c5b1e583e6e55ef9dd153b97ec5967853eec5 Mon Sep 17 00:00:00 2001 From: Himanshu Kumar Mahto <93067059+HimanshuMahto@users.noreply.github.com> Date: Thu, 26 Oct 2023 09:52:37 +0530 Subject: [PATCH] Remove the scrollbar from the subscriber section --- src/components/layout/JoinUs/NewsLetter.jsx | 28 ++++++++++++++------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/src/components/layout/JoinUs/NewsLetter.jsx b/src/components/layout/JoinUs/NewsLetter.jsx index 68f73805..a5c5e030 100644 --- a/src/components/layout/JoinUs/NewsLetter.jsx +++ b/src/components/layout/JoinUs/NewsLetter.jsx @@ -4,15 +4,25 @@ const NewsLetter = () => { const [iframeHeight, setIframeHeight] = useState(670); useEffect(() => { - const windowWidth = window.innerWidth; - - if (windowWidth < 900) { - setIframeHeight(830); - } else if (windowWidth < 1250) { - setIframeHeight(700); - } else { - setIframeHeight(670); - } + const updateIframeHeight = () => { + const windowWidth = window.innerWidth; + + if (windowWidth < 900) { + setIframeHeight(830); + } else if (windowWidth < 1250) { + setIframeHeight(700); + } else { + setIframeHeight(670); + } + }; + + updateIframeHeight(); + + window.addEventListener('resize', updateIframeHeight); + + return () => { + window.removeEventListener('resize', updateIframeHeight); + }; }, []); return (