mirror of
https://github.com/ershisan99/podcaster.git
synced 2025-12-16 20:59:26 +00:00
wip: add layout component and wrap the app
This commit is contained in:
14
src/components/layout.tsx
Normal file
14
src/components/layout.tsx
Normal file
@@ -0,0 +1,14 @@
|
||||
import { Outlet } from "react-router-dom";
|
||||
|
||||
export function Layout() {
|
||||
return (
|
||||
<div>
|
||||
<header>
|
||||
<h1>Header</h1>
|
||||
</header>
|
||||
<main>
|
||||
<Outlet />
|
||||
</main>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -3,23 +3,29 @@ import { Home } from "./pages/home";
|
||||
import { Podcast } from "./pages/podcast";
|
||||
import { Episode } from "./pages/episode";
|
||||
import { PodcastEpisodesList } from "./components/podcast-episodes-list";
|
||||
import { Layout } from "./components/layout";
|
||||
|
||||
const router = createBrowserRouter([
|
||||
{
|
||||
path: "/",
|
||||
element: <Home />,
|
||||
},
|
||||
{
|
||||
path: "/podcast",
|
||||
element: <Podcast />,
|
||||
element: <Layout />,
|
||||
children: [
|
||||
{
|
||||
path: ":podcastId",
|
||||
element: <PodcastEpisodesList />,
|
||||
path: "/",
|
||||
element: <Home />,
|
||||
},
|
||||
{
|
||||
path: ":podcastId/episode/:episodeId",
|
||||
element: <Episode />,
|
||||
path: "/podcast",
|
||||
element: <Podcast />,
|
||||
children: [
|
||||
{
|
||||
path: ":podcastId",
|
||||
element: <PodcastEpisodesList />,
|
||||
},
|
||||
{
|
||||
path: ":podcastId/episode/:episodeId",
|
||||
element: <Episode />,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user