mirror of
https://github.com/ershisan99/podcaster.git
synced 2026-01-03 21:02:07 +00:00
chore: set up routing with mock pages
This commit is contained in:
@@ -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
3
src/pages/episode.tsx
Normal file
@@ -0,0 +1,3 @@
|
||||
export function Episode() {
|
||||
return <h1>Episode page</h1>;
|
||||
}
|
||||
3
src/pages/home.tsx
Normal file
3
src/pages/home.tsx
Normal file
@@ -0,0 +1,3 @@
|
||||
export function Home() {
|
||||
return <h1>Home page</h1>;
|
||||
}
|
||||
3
src/pages/podcast.tsx
Normal file
3
src/pages/podcast.tsx
Normal file
@@ -0,0 +1,3 @@
|
||||
export function Podcast() {
|
||||
return <h1>Podcast page</h1>;
|
||||
}
|
||||
23
src/router.tsx
Normal file
23
src/router.tsx
Normal 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} />;
|
||||
}
|
||||
Reference in New Issue
Block a user