blob: 5ba8e6f6eb20a4377f2cd05eb960bb50a2de31fd (
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
|
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';
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 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>
</div>
</>
)
}
|