feat: add router config, router, and sidenav config
This commit is contained in:
48
src/routes/config.tsx
Normal file
48
src/routes/config.tsx
Normal file
@@ -0,0 +1,48 @@
|
||||
import { Layout } from '@/components/Layout/Layout';
|
||||
import { Mobile, Personalcard, ProfileCircle, type Icon } from 'iconsax-react';
|
||||
import { type ReactNode } from 'react';
|
||||
import { Navigate } from 'react-router-dom';
|
||||
|
||||
export interface RouteConfig {
|
||||
path: string;
|
||||
element?: ReactNode;
|
||||
navConfig?: {
|
||||
title: string; // Translation key
|
||||
icon?: Icon;
|
||||
};
|
||||
children?: RouteConfig[];
|
||||
}
|
||||
|
||||
export const appRoutes: RouteConfig[] = [
|
||||
{
|
||||
path: '/',
|
||||
element: <Navigate to="/profile" replace />,
|
||||
},
|
||||
{
|
||||
path: '/profile',
|
||||
// can lazy load component if needed (ex. lazy(() => import('@/features/home/routes/HomePage'));)
|
||||
element: <Layout />,
|
||||
navConfig: {
|
||||
title: 'side.account',
|
||||
icon: ProfileCircle,
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: '/profile/info',
|
||||
element: <div>Personal Info Section</div>,
|
||||
navConfig: {
|
||||
title: 'side.personalInfo',
|
||||
icon: Personalcard,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: '/profile/contact-info',
|
||||
element: <div>Personal Info Section</div>,
|
||||
navConfig: {
|
||||
title: 'side.contactInfo',
|
||||
icon: Mobile,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
Reference in New Issue
Block a user