1
Fork 0
href-plus/source/ts/single-page-application.ts

32 lines
864 B
TypeScript
Raw Normal View History

2021-12-30 22:40:57 +00:00
// Uncomment when debugging and using Preact's DevTools WebExtension.
// import 'preact/debug';
2022-01-01 14:27:01 +00:00
import '@fontsource/inter/latin.css';
2021-12-30 22:40:57 +00:00
import {html, render} from 'htm/preact';
import {Router} from 'preact-router';
import HomePage from './pages/home.js';
import NotFoundPage from './pages/not-found.js';
import ReleasePage from './pages/release.js';
import {themeContext, themes} from './utilities/themes.js';
const savedTheme = window.localStorage.getItem('theme');
const activeTheme =
themes.find((theme) => theme.cssClass === savedTheme) ?? themes[0];
document.body.classList.value = activeTheme.cssClass;
2021-12-30 22:40:57 +00:00
render(
html`
<${themeContext.Provider} value=${activeTheme}>
<${Router}>
<${HomePage} path="/" />
<${ReleasePage} path="/release/:mbid" />
<${NotFoundPage} default />
<//>
2021-12-30 22:40:57 +00:00
<//>
`,
document.body,
);