-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
91 lines (76 loc) · 2.65 KB
/
App.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
//Module Imports
import React, { useState, useEffect} from 'react'
import SynthwaveBackground from './experimental/SynthwaveBackground/SynthwaveBackground'
import AsciiTitle from './experimental/AsciiTitle/AsciiTitle';
import Navbar from './experimental/Navbar/Navbar';
import MainContext from './MainContext'
//React Components
import AboutOverlay from './pages/AboutOverlay/AboutOverlay';
import ExperienceOverlay from './pages/ExperienceOverlay/ExperienceOverlay';
import ProjectOverlay from './pages/ProjectOverlay/ProjectOverlay';
//Misc
import "./styles.css";
export default function App(props) {
const [experimentalMode, setExperimentalMode] = useState(true)
const setExpMode = (mode) => setExperimentalMode(mode);
const expMode = () => experimentalMode;
const [page, setPage] = useState("HOME");
const setCurrentPage = (inPage) => setPage(inPage);
const currentPage = () => page;
const [pPage, setpPage] = useState("HOME");
const setPriorPage = (inPage) => setpPage(inPage);
const priorPage = () => pPage;
const api = {setCurrentPage, currentPage, setPriorPage, priorPage, setExpMode, expMode};
useEffect(() => {
setTimeout(() => { waitFunc(); }, 2000);
},[]
);
const waitFunc = () =>{
document.getElementById("loadText").innerHTML = "CLICK ANYWHERE TO START";
document.getElementById("warningText").className = "loadText";
}
const changeFunc = () =>{
document.getElementById("song").play();
setExperimentalMode(false);
}
const renderPage = () =>{
if(api.currentPage() ==="HOME"){
}else if (api.currentPage() ==="ABT"){
return <AboutOverlay />
}else if (api.currentPage() ==="PROJ"){
return <ProjectOverlay />
}else if (api.currentPage() ==="EXP"){
return <ExperienceOverlay />
}
}
return (
<>
<MainContext.Provider value={api}>
{
experimentalMode ?
<div id="spinOver" onClick={ () => changeFunc() }>
<div class="spinner">
<p id="loadText">LOADING</p>
<div class="rect1"></div>
<div class="rect2"></div>
<div class="rect3"></div>
<div class="rect4"></div>
<div class="rect5"></div>
<p id="warningText">WARNING: You May Experience Large Lag Spikes!</p>
</div>
</div>
:
<>
<SynthwaveBackground />
<Navbar />
<div id="overlay">
<div id="titleOverlay">
<AsciiTitle />
</div>
{renderPage()}
</div></>
}
</MainContext.Provider>
</>
);
}