Nextjs Routing System
We’ve created these dynamic routes, so the
Sidebar component
would not get too loaded with code. You will find all our demo
routes in
routes.js
.
Legend FREE
-
path
(path for your route - this will be seen in the browser url input - example/dashboard
) -
name
(name of your route - this will appear in theSidebar
andAdminNavbar
components - exampleDashboard
) -
icon
(icon to be displayed alongside with links inSidebar
component - example fa fa-heart) -
layout
(path of the layout in which the View component you want to be rendered - in our template demo you only have to options:/admin
and/auth
- but due to this routing system you can add more, for example/new-layout
)
Legend PRO
-
path
(path for your route - this will be seen in the browser url input - example/dashboard
) -
name
(name of your route - this will appear in theSidebar
andHeader
components) -
icon
(icon to be displayed alongside with links inSidebar
component - examplefa fa-heart
) -
layout
(path of the layout in which the View component you want to be rendered - in our template demo you only have to options:/admin
and/auth
- but due to this routing system you can add more, for example/new-layout
)
-
collapse
(used to tell our deom app components this is a collapsible group - forcomponents/Sidebar/Sidebar.js
,layouts/Admin/Admin.js
andlayouts/Auth/Auth.js
- you can only use it like so:collapse: true
) -
name
(name of collapsible group that is displayed incomponents/Sidebar/Sidebar.js
- exampleForms
) -
state
(name of the state used incomponents/Sidebar/Sidebar.js
’s state to know which collapsible is active/collapsed - based on these the state of thecomponents/Sidebar/Sidebar.js
is created - exmaplepagesCollapse
) -
icon
(icon to be displayed alonside the name of the collapsible group - examplefa fa-heart
) -
views
(array of links that will be part of the collapsible group)
arrayOfRoutes
:
-
miniName
(this is a single uppercase letter that appears when theSidebar
component is minified)
Notice
For a better understanding, please take a look inside the file at hand, and also how the routes are rendered while the app is opened.
Because our routes are arrays of objects, and each route is an object, you can add what props you want in our routes and do what you want with them.
For example, if you want to “hide” a route (you want it to not be
displayed in sidebar), you could add a prop like
invisible: true
and then in
Sidebar
add an if statement inside the
map
function of ours and do like this:
Or, simply, you would not add it inside the
routes.js
file, and you would only add it inside the
Switch
component of your routing system (if you are still using
react-router-dom
- for example inside
src/index.js
, or
src/layouts/Admin.js
, or
src/layouts/RTL.js
, or
src/layouts/Auth.js
)