Routing
How to setup route?
(Set the path in src/routes/Router.tsx.)
// ------------------------------------------------------------------------
// File: src/routes/Router.tsx
// ------------------------------------------------------------------------
import { lazy } from 'react';
import { Navigate, createBrowserRouter } from 'react-router';
import Loadable from '../layouts/full/shared/loadable/Loadable';
/* ***Layouts*** */
const FullLayout = Loadable(lazy(() => import('../layouts/full/FullLayout')));
/* ***Dashboard Pages*** */
const Modern = Loadable(lazy(() => import('../views/dashboards/Modern')));
const Ecommercedash = Loadable(lazy(() => import('../views/dashboards/Ecommerce')));
const Musicdash = Loadable(lazy(() => import('../views/dashboards/Music')));
const Generaldash = Loadable(lazy(() => import('../views/dashboards/General')));
/* ***import rest of your Pages*** */
const Router = [
{
path: '/',
element: <FullLayout />,
children: [
{ path: '/', exact: true, element: <Modern /> },
{ path: '/dashboards/modern', exact: true, element: <Modern /> },
{ path: '/dashboards/eCommerce', exact: true, element: <Ecommercedash /> },
{ path: '/dashboards/music', exact: true, element: <Musicdash /> },
{ path: '/dashboards/general', exact: true, element: <Generaldash /> },
/* ***import rest of your Pages*** */
],
},
];
How to add a page to the sidebar?
(Set the path the same as you define it in Router.tsx.)
// ------------------------------------------------------------------------
// File: src/layouts/full/vertical/sidebar/Sidebaritems.ts
// ------------------------------------------------------------------------
const SidebarContent: MenuItem[] = [
{
heading: 'Home',
children: [
{
name: 'Modern',
icon: 'solar:widget-2-linear',
id: uniqueId(),
url: '/',
},
{
name: 'Ecommerce',
icon: 'solar:bag-5-linear',
id: uniqueId(),
url: '/dashboards/eCommerce',
},
{
name: 'Music',
icon: 'solar:music-note-linear',
id: uniqueId(),
url: '/dashboards/music',
},
{
name: 'General',
icon: 'solar:chart-linear',
id: uniqueId(),
url: '/dashboards/general',
}
],
},
];