add sidebar with redux
- add store - add routes - add page wrapper, mainlayout - add nav folder
This commit is contained in:
34
src/routes/index.js
Normal file
34
src/routes/index.js
Normal file
@@ -0,0 +1,34 @@
|
||||
import { Route } from "react-router-dom";
|
||||
import PageWrapper from "../components/PageWrapper";
|
||||
import appRoutes from "./appRoutes";
|
||||
|
||||
const generateRoute = (routes) => {
|
||||
return routes.map((route, index) => (
|
||||
route.index ? (
|
||||
<Route
|
||||
index
|
||||
path={route.path}
|
||||
element={<PageWrapper state={route.state}>
|
||||
{route.element}
|
||||
</PageWrapper>}
|
||||
key={index}
|
||||
/>
|
||||
) : (
|
||||
<Route
|
||||
path={route.path}
|
||||
element={
|
||||
<PageWrapper state={route.child ? undefined : route.state}>
|
||||
{route.element}
|
||||
</PageWrapper>
|
||||
}
|
||||
key={index}
|
||||
>
|
||||
{route.child && (
|
||||
generateRoute(route.child)
|
||||
)}
|
||||
</Route>
|
||||
)
|
||||
));
|
||||
};
|
||||
|
||||
export const routes = generateRoute(appRoutes);
|
||||
Reference in New Issue
Block a user