From 813085874c788a3f6ee3bda88cefafbcd82add4d Mon Sep 17 00:00:00 2001 From: Illaf Date: Tue, 1 Aug 2023 15:23:44 +0530 Subject: [PATCH] fixed build error --- src/components/layout/Header.tsx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/components/layout/Header.tsx b/src/components/layout/Header.tsx index 59115be8..01632ce5 100644 --- a/src/components/layout/Header.tsx +++ b/src/components/layout/Header.tsx @@ -35,6 +35,7 @@ const Menubar: FC = ({ closeMenu, }) => { const { theme } = React.useContext(SettingsContext); + const progressBarHandler = () => { const totalScroll = document.documentElement.scrollTop; const windowHeight = @@ -42,8 +43,11 @@ const Menubar: FC = ({ document.documentElement.clientHeight; const scroll = `${totalScroll / windowHeight}`; const progressBar = document.getElementById('progressBar'); - progressBar.style.transform = `scale(${scroll},1)`; - progressBar.style.opacity = `${scroll}`; + progressBar?.classList.add('visible'); + if (progressBar) { + progressBar.style.transform = `scale(${scroll},1)`; + progressBar.style.opacity = `${scroll}`; + } }; useEffect(() => { window.addEventListener('scroll', progressBarHandler); @@ -51,7 +55,9 @@ const Menubar: FC = ({ return ( <>
-
+
+

+