Skip to content

Commit

Permalink
chore: add base routepath to router
Browse files Browse the repository at this point in the history
  • Loading branch information
singhAmandeep007 committed May 19, 2024
1 parent 5ce9309 commit d5eab79
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 42 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,6 @@ stories
# reports
/reports

*storybook.log
*storybook.log

*.todo
85 changes: 44 additions & 41 deletions src/Router.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { useMemo, useRef, useState } from "react";
import { Outlet, RouterProvider, createBrowserRouter } from "react-router-dom";

import { fakeDelay } from "@/Common/utils";
import { SidebarMenu } from "@/Components/SidebarMenu";
import { ToggleTheme } from "@/Components/ToggleTheme";
import { useOnClickOutside } from "@/Hooks/useOnClickOutside";
Expand Down Expand Up @@ -36,51 +35,55 @@ const Layout = () => {
);
};

const router = createBrowserRouter([
{
element: <Layout />,
children: [
{
path: "/",
const router = createBrowserRouter(
[
{
element: <Layout />,
children: [
{
path: "/",

lazy: async () => {
await fakeDelay(2000);
const { HomePage } = await import("@/Pages/HomePage");
return {
Component: HomePage,
};
lazy: async () => {
const { HomePage } = await import("@/Pages/HomePage");
return {
Component: HomePage,
};
},
},
},
{
path: "/about",
lazy: async () => {
const { AboutPage } = await import("@/Pages/AboutPage");
return {
Component: AboutPage,
};
{
path: "/about",
lazy: async () => {
const { AboutPage } = await import("@/Pages/AboutPage");
return {
Component: AboutPage,
};
},
},
},
{
path: "/articles",
lazy: async () => {
const { ArticlesPage } = await import("@/Pages/ArticlesPage");
return {
Component: ArticlesPage,
};
{
path: "/articles",
lazy: async () => {
const { ArticlesPage } = await import("@/Pages/ArticlesPage");
return {
Component: ArticlesPage,
};
},
},
},
{
path: "/projects",
lazy: async () => {
const { ProjectsPage } = await import("@/Pages/ProjectsPage");
return {
Component: ProjectsPage,
};
{
path: "/projects",
lazy: async () => {
const { ProjectsPage } = await import("@/Pages/ProjectsPage");
return {
Component: ProjectsPage,
};
},
},
},
],
},
]);
],
},
],
{
basename: "/myPortfolio",
}
);

export const Router = () => (
<RouterProvider
Expand Down

0 comments on commit d5eab79

Please sign in to comment.