diff options
| author | Stanisław Zagórowski <hasohasacz@gmail.com> | 2023-08-30 18:00:11 +0200 |
|---|---|---|
| committer | Stanisław Zagórowski <hasohasacz@gmail.com> | 2023-08-30 18:00:11 +0200 |
| commit | b7c37574f4f90fc346bc51dd06c77c8958570b33 (patch) | |
| tree | 72895a18a8d72ecd35bf9b71030d6bf40ae34167 /front/src/app.tsx | |
| parent | b661407d801c8ccaa7773ae30f0fc26a1d70ffff (diff) | |
all: move front into its own directory
Diffstat (limited to 'front/src/app.tsx')
| -rw-r--r-- | front/src/app.tsx | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/front/src/app.tsx b/front/src/app.tsx new file mode 100644 index 0000000..5ba8e6f --- /dev/null +++ b/front/src/app.tsx @@ -0,0 +1,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> + </> + ) +} |
