Skip to content

Commit

Permalink
updated
Browse files Browse the repository at this point in the history
  • Loading branch information
QuvonchbekBobojonov committed Mar 8, 2024
1 parent 5fadb4e commit ad71044
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions frontend/src/components/page-loader/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,25 @@ import { useEffect } from 'react';

function PageLoader() {
useEffect(() => {
setTimeout(() => {
const pageLoader = document.querySelector('.page-loader');
const pageLoader = document.querySelector('.page-loader');

const fadeOutPageLoader = () => {
if (pageLoader) {
pageLoader.style.transition = 'opacity 1s';
pageLoader.style.opacity = '0';

setTimeout(() => {
pageLoader.style.display = 'none';
}, 2000);
}, 1000);
}
}, 1500);
};

window.addEventListener('load', () => {
setTimeout(fadeOutPageLoader, 500);
});

return () => {
window.removeEventListener('load', fadeOutPageLoader);
};
}, []);

return (
Expand Down

0 comments on commit ad71044

Please sign in to comment.