chore: set up routing with mock pages

This commit is contained in:
2024-04-18 15:26:02 +02:00
parent 6d8ec83bcb
commit 4671b5e707
7 changed files with 68 additions and 2 deletions

View File

@@ -1,3 +1,5 @@
import { Router } from "./router";
export function App() {
return <h1 className="text-3xl font-bold underline">hello, world!</h1>;
return <Router />;
}

3
src/pages/episode.tsx Normal file
View File

@@ -0,0 +1,3 @@
export function Episode() {
return <h1>Episode page</h1>;
}

3
src/pages/home.tsx Normal file
View File

@@ -0,0 +1,3 @@
export function Home() {
return <h1>Home page</h1>;
}

3
src/pages/podcast.tsx Normal file
View File

@@ -0,0 +1,3 @@
export function Podcast() {
return <h1>Podcast page</h1>;
}

23
src/router.tsx Normal file
View File

@@ -0,0 +1,23 @@
import { createBrowserRouter, RouterProvider } from "react-router-dom";
import { Home } from "./pages/home";
import { Podcast } from "./pages/podcast";
import { Episode } from "./pages/episode";
const router = createBrowserRouter([
{
path: "/",
element: <Home />,
},
{
path: "/podcast/:podcastId",
element: <Podcast />,
},
{
path: "/podcast/:podcastId/episode/:episodeId",
element: <Episode />,
},
]);
export function Router() {
return <RouterProvider router={router} />;
}