aboutsummaryrefslogtreecommitdiff
path: root/front/src/app.tsx
blob: ba081c9f6e44e5adda6cae77397b38abe336602a (plain) (blame)
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
import './app.css'
import { Navbar } from './components/navbar'
import Contact from './pages/contact';
import Games from './pages/games';
import Home from './pages/home'
import { Router, Route, CustomHistory } from 'preact-router';
import Projects from './pages/projects';
import { HashHistory, createHashHistory } from 'history';
import { AnimatedBg } from './components/animated_bg';

const hashHistoryAdapter = (hashHistory: HashHistory): CustomHistory => {
    return {
        listen: (callback) => hashHistory.listen(({ location }) => callback(location)),
        location: hashHistory.location,
        push: hashHistory.push,
        replace: hashHistory.replace
    };
};
export function App() {
    const history = hashHistoryAdapter(createHashHistory());

    return (
        <>
            <Navbar />
            <div class="back-shadows"></div>
            <div id="app-main">
                <Router history={history}>
                    <Route path="/" component={Home} />
                    <Route path="/contact" component={Contact} />
                    <Route path="/games" component={Games} />
                    <Route path="/projects" component={Projects} />
                </Router>
                <AnimatedBg />
            </div>
        </>
    )
}