Add loader until page loads completely

This commit is contained in:
2021-10-03 15:59:24 +01:00
parent 90a31e8923
commit 80e7c24811
18 changed files with 280 additions and 147 deletions

View File

@@ -1,9 +1,9 @@
import React from 'react';
import React, { useEffect } from 'react';
import NavBar from './NavBar';
import Footer from "./Footer";
import { HomeRounded as HomeRoundedIcon } from "@material-ui/icons";
export default function PageNotFound() {
export default function PageNotFound(props) {
const navbarItems = [
{
type: "link",
@@ -15,7 +15,18 @@ export default function PageNotFound() {
document.title = "Error 404 | Parandum";
const page = props.page;
useEffect(() => {
if (page) {
page.load();
return () => page.unload();
}
}, [page]);
return (
!page.loaded
?
<div>
<NavBar items={navbarItems}/>
<main>
@@ -24,5 +35,7 @@ export default function PageNotFound() {
</main>
<Footer />
</div>
:
null
)
}