create 404.tsx and update index.ts

This commit is contained in:
Raymond Wang 2022-11-04 13:37:02 -07:00
parent 68aa6637d6
commit 62ec3a05c7
3 changed files with 44 additions and 2 deletions

1
.gitignore vendored
View file

@ -1,3 +1,4 @@
build
node_modules
.DS_Store
firebase-debug.log

31
src/public/404.tsx Normal file
View file

@ -0,0 +1,31 @@
import * as ReactDom from "react-dom";
import * as React from "react";
import TopBar from "./components/TopBar";
import { ACTIVE_PAGES } from "./Config";
import Splash from "./components/Splash";
import Footer from "./components/Footer";
class Main extends React.Component {
constructor() {
super({});
this.state = {};
}
public render() {
return (
<>
<TopBar links={ACTIVE_PAGES}></TopBar>
<Splash
cta="Page Not Found"
delay={2000}
backgrounds={["/assets/img/backgrounds/fa21qp.webp"]}
></Splash>
<Footer></Footer>
</>
);
}
}
ReactDom.render(<Main></Main>, document.getElementById("root"));
export default {};

View file

@ -12,6 +12,7 @@ interface Website {
cssfile: string;
themecolor: string;
path?: string;
filename?: string;
}
const APP = express();
@ -53,6 +54,16 @@ const WEBSITES = [
cssfile: "/assets/css/styles.css",
themecolor: "",
},
{
sitename: "404",
title: "Page Not Found",
description: "404 Page Not Found",
jsfile: "/assets/js/404.js",
cssfile: "/assets/css/styles.css",
themecolor: "",
path: "/",
filename: "404.html",
},
] as Website[];
const PORT = process.env.PORT ?? 9000;
@ -118,8 +129,7 @@ function generateFilePages() {
path.join(
__dirname,
"../public/",
site.path ?? site.sitename,
"/index.html"
site.filename ?? (site.path ?? site.sitename) + "/index.html"
),
html
);