Skip to content

Commit

Permalink
chore: nested routerをbrowser routerに置き換えた (#113)
Browse files Browse the repository at this point in the history
* feat: /に各機能ごとのページへのリンクを書いた

* chore: nested routerをbrowser routerに置き換えた

* chore: レイアウトが正しく反映されるようにした

* chore: basenameの追加とコンフリクトの解決を行った
  • Loading branch information
toranomonn authored Jul 19, 2024
1 parent 4430717 commit 5f59d97
Showing 1 changed file with 37 additions and 16 deletions.
53 changes: 37 additions & 16 deletions packages/kcmsf/src/routes/router.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import {
Route,
createBrowserRouter,
createRoutesFromElements,
} from "react-router-dom";
import { createBrowserRouter } from "react-router-dom";
import { Entry } from "../pages/entry.tsx";
import { EntryList } from "../pages/entryList.tsx";
import { Home } from "../pages/home.tsx";
Expand All @@ -13,17 +9,42 @@ import { Result } from "../pages/result.tsx";
import { Layout } from "./layout.tsx";

export const router = createBrowserRouter(
createRoutesFromElements(
<Route path="/" element={<Layout />}>
<Route index element={<Home />} />
<Route path="/entrylist" element={<EntryList />} />
<Route path="/ranking" element={<Ranking />} />
<Route path="/entry" element={<Entry />} />
<Route path="/matchlist" element={<MatchList />} />
<Route path="/match" element={<Match />} />
<Route path="/result" element={<Result />} />
</Route>
),
[
{
path: "/",
element: <Layout />,
children: [
{
index: true,
element: <Home />,
},
{
path: "entrylist",
element: <EntryList />,
},
{
path: "entry",
element: <Entry />,
},
{
path: "match",
element: <Match />,
},
{
path: "matchlist",
element: <MatchList />,
},
{
path: "ranking",
element: <Ranking />,
},
{
path: "result",
element: <Result />,
},
],
},
],
{
basename: import.meta.env.BASE_URL,
}
Expand Down

0 comments on commit 5f59d97

Please sign in to comment.