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
andNavbar
components - exampleDashboard
) -
rtlName
(name of your route - this will appear in theSidebar
andNavbar
components - exampleلوحة القيادة
ifrtlActive
prop is set on theSidebar
andNavbar
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/rtl
- 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 - exampleلوحة القيادة
on the RTL layout) -
rtlName
(name of your route - this will appear in theSidebar
andHeader
components - exampleDashboard
) -
icon
(icon to be displayed alongside with links inSidebar
component - examplefavorite
orFavorite
from@material-ui/icons
) -
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 demo app components this is a collapsible group - forcomponents/Sidebar/Sidebar.js
- you can only use it like so:collapse: true
) -
name
(name of collapsible group that is displayed incomponents/Sidebar/Sidebar.js
- exampleForms
) -
rtlName
(name of collapsible group that is displayed incomponents/Sidebar/Sidebar.js
- exampleإستمارات
, on the RTL layout) -
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 inside theSidebar
component - examplefavorite
orFavorite
from@material-ui/icons
) -
views
(array of links that will be part of the collapsible group)
arrayOfRoutes
can be
Notice
For a better understanding, please take a look inside the file at hand, and also how the routes are rendered while the app si 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, just do not add it inside the
routes.js
file.