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')));
/* ***import rest of your Pages*** */
const Router = [
{
path: '/',
element: <FullLayout />,
children: [
{ path: '/', exact: true, element: <Modern /> },
{ path: '/dashboards/modern', exact: true, element: <Modern /> },
/* ***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: '/',
isPro: false,
},
{
name: 'Ecommerce',
icon: 'solar:bag-5-linear',
id: uniqueId(),
url: 'https://tailwindadmin-reactjs-main.netlify.app/dashboards/eCommerce',
isPro: true,
},
{
name: 'Music',
icon: 'solar:music-note-linear',
id: uniqueId(),
url: 'https://tailwindadmin-reactjs-main.netlify.app/dashboards/music',
isPro: true,
},
{
name: 'General',
icon: 'solar:chart-linear',
id: uniqueId(),
url: 'https://tailwindadmin-reactjs-main.netlify.app/dashboards/general',
isPro: true,
},
],
},
]