feat: add frontend app routing
This commit is contained in:
@@ -1,5 +1,30 @@
|
||||
import { App } from './App'
|
||||
import * as React from 'react'
|
||||
|
||||
import { DesignSystemPreview } from '@/features/design-system/DesignSystemPreview'
|
||||
|
||||
function getRoute() {
|
||||
return window.location.hash.replace(/^#/, '') || '/tickets'
|
||||
}
|
||||
|
||||
export function Router() {
|
||||
return <App />
|
||||
const [route, setRoute] = React.useState(getRoute)
|
||||
|
||||
React.useEffect(() => {
|
||||
const handleHashChange = () => setRoute(getRoute())
|
||||
window.addEventListener('hashchange', handleHashChange)
|
||||
return () => window.removeEventListener('hashchange', handleHashChange)
|
||||
}, [])
|
||||
|
||||
if (route === '/design-system') {
|
||||
return <DesignSystemPreview />
|
||||
}
|
||||
|
||||
return (
|
||||
<main className="min-h-screen bg-background p-6 text-foreground">
|
||||
<div className="mx-auto max-w-6xl">
|
||||
<p className="text-sm text-muted-foreground">Route</p>
|
||||
<h1 className="mt-2 text-xl font-semibold">{route}</h1>
|
||||
</div>
|
||||
</main>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user