Skip to content

Commit

Permalink
Fix hardcoded loading animation
Browse files Browse the repository at this point in the history
  • Loading branch information
AmirAgassi committed Mar 27, 2024
1 parent 2a9fd8c commit 59a7034
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/pages/Landing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,17 @@ import {
const Landing: React.FC = () => {
const [isLoading, setIsLoading] = useState(true);

useEffect(() => {
// Delay for LoadingAnimation
const timer = setTimeout(() => {
setIsLoading(false);
}, 3000);
useEffect(() => {
const handleLoad = () => {
setTimeout(() => {
setIsLoading(false);
}, 1000);
};

return () => clearTimeout(timer);
}, []);
window.addEventListener('load', handleLoad);

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

if (isLoading) {
return <LoadingAnimation />;
Expand Down

0 comments on commit 59a7034

Please sign in to comment.