Skip to content

Commit

Permalink
fixed build error
Browse files Browse the repository at this point in the history
  • Loading branch information
Illaf committed Aug 1, 2023
1 parent e403cdb commit 8130858
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/components/layout/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,29 @@ const Menubar: FC<Props> = ({
closeMenu,
}) => {
const { theme } = React.useContext(SettingsContext);

const progressBarHandler = () => {
const totalScroll = document.documentElement.scrollTop;
const windowHeight =
document.documentElement.scrollHeight -
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);
});
return (
<>
<div id="progressBarContainer">
<div id="progressBar"></div>
<div id="progressBar">
<h1></h1>
</div>
</div>
<div
className={`${
Expand Down

0 comments on commit 8130858

Please sign in to comment.