trying alt router

This commit is contained in:
Orion Reed 2023-08-12 18:50:34 +01:00
parent 834a2dd72b
commit 792874b3fc
3 changed files with 18 additions and 14 deletions

9
package-lock.json generated
View File

@ -16,6 +16,7 @@
"minisearch": "^6.1.0", "minisearch": "^6.1.0",
"preact": "^10.13.1", "preact": "^10.13.1",
"preact-iso": "^2.3.1", "preact-iso": "^2.3.1",
"preact-router": "^4.1.2",
"reading-time-estimator": "^1.9.0" "reading-time-estimator": "^1.9.0"
}, },
"devDependencies": { "devDependencies": {
@ -5996,6 +5997,14 @@
"preact": ">=10" "preact": ">=10"
} }
}, },
"node_modules/preact-router": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/preact-router/-/preact-router-4.1.2.tgz",
"integrity": "sha512-uICUaUFYh+XQ+6vZtQn1q+X6rSqwq+zorWOCLWPF5FAsQh3EJ+RsDQ9Ee+fjk545YWQHfUxhrBAaemfxEnMOUg==",
"peerDependencies": {
"preact": ">=10"
}
},
"node_modules/pretty-format": { "node_modules/pretty-format": {
"version": "3.8.0", "version": "3.8.0",
"resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-3.8.0.tgz", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-3.8.0.tgz",

View File

@ -18,7 +18,7 @@
"jsonlines": "^0.1.1", "jsonlines": "^0.1.1",
"minisearch": "^6.1.0", "minisearch": "^6.1.0",
"preact": "^10.13.1", "preact": "^10.13.1",
"preact-iso": "^2.3.1", "preact-router": "^4.1.2",
"reading-time-estimator": "^1.9.0" "reading-time-estimator": "^1.9.0"
}, },
"devDependencies": { "devDependencies": {

View File

@ -1,6 +1,6 @@
import 'preact/debug' import 'preact/debug'
import { render } from 'preact' import { render } from 'preact'
import { LocationProvider, Router, Route } from 'preact-iso' import Router from 'preact-router'
import { Home } from '@/pages/Home' import { Home } from '@/pages/Home'
import { Posts } from '@/pages/Posts' import { Posts } from '@/pages/Posts'
import Post from '@/pages/Post' import Post from '@/pages/Post'
@ -14,18 +14,13 @@ export function App() {
return ( return (
<MantineProvider withGlobalStyles withNormalizeCSS theme={theme}> <MantineProvider withGlobalStyles withNormalizeCSS theme={theme}>
<Box mb="xl"> <Box mb="xl">
<LocationProvider> <Router>
<Router> <Home path="/" />
<Route path="/" component={Home} /> <Posts path="/posts" />
<Route path="/posts" component={Posts} /> <Post path="/posts/:title" />
<Route path="/posts/" component={Posts} /> <Stream path="/stream" />
<Route path="/posts/:title" component={Post} /> <NotFound default />
<Route path="/posts/:title/" component={Post} /> </Router>
<Route path="/stream" component={Stream} />
<Route path="/stream/" component={Stream} />
<Route default component={NotFound} />
</Router>
</LocationProvider>
</Box> </Box>
</MantineProvider> </MantineProvider>
) )