feat: added submenu system at sidebar (#2486)

* fix: Removed Strict mode to stop render twice

* feat: added submenu system at sidebar
This commit is contained in:
Chintan Sudani 2023-03-23 14:50:17 +05:30 committed by GitHub
parent da4cbf6c2f
commit c3763032df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 2 deletions

View File

@ -98,7 +98,7 @@ function SideNav(): JSX.Element {
);
const items = [
...menus.map(({ to, Icon, name, tags }) => ({
...menus.map(({ to, Icon, name, tags, children }) => ({
key: to,
icon: <Icon />,
onClick: (): void => onClickHandler(to),
@ -113,6 +113,7 @@ function SideNav(): JSX.Element {
))}
</Space>
),
children,
})),
];
@ -129,7 +130,7 @@ function SideNav(): JSX.Element {
theme="dark"
defaultSelectedKeys={[ROUTES.APPLICATION]}
selectedKeys={currentMenu ? [currentMenu?.to] : []}
mode="inline"
mode="vertical"
style={styles}
items={items}
/>

View File

@ -10,6 +10,7 @@ import {
MenuOutlined,
SettingOutlined,
} from '@ant-design/icons';
import type { MenuProps } from 'antd';
import ROUTES from 'constants/routes';
const menus: SidebarMenu[] = [
@ -28,6 +29,12 @@ const menus: SidebarMenu[] = [
to: ROUTES.LOGS,
name: 'Logs',
// tags: ['Beta'],
children: [
{
key: ROUTES.LOGS,
label: 'Search',
},
],
},
{
Icon: DashboardFilled,
@ -71,6 +78,7 @@ interface SidebarMenu {
name: string;
Icon: typeof ApiOutlined;
tags?: string[];
children?: Required<MenuProps>['items'][number][];
}
export default menus;