From c3763032df045a824153fc4cff5082693c04319d Mon Sep 17 00:00:00 2001
From: Chintan Sudani <46838508+techchintan@users.noreply.github.com>
Date: Thu, 23 Mar 2023 14:50:17 +0530
Subject: [PATCH] feat: added submenu system at sidebar (#2486)
* fix: Removed Strict mode to stop render twice
* feat: added submenu system at sidebar
---
frontend/src/container/SideNav/index.tsx | 5 +++--
frontend/src/container/SideNav/menuItems.ts | 8 ++++++++
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/frontend/src/container/SideNav/index.tsx b/frontend/src/container/SideNav/index.tsx
index a033854e86..24e888797c 100644
--- a/frontend/src/container/SideNav/index.tsx
+++ b/frontend/src/container/SideNav/index.tsx
@@ -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: ,
onClick: (): void => onClickHandler(to),
@@ -113,6 +113,7 @@ function SideNav(): JSX.Element {
))}
),
+ 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}
/>
diff --git a/frontend/src/container/SideNav/menuItems.ts b/frontend/src/container/SideNav/menuItems.ts
index a900e366eb..5be9c9b9a1 100644
--- a/frontend/src/container/SideNav/menuItems.ts
+++ b/frontend/src/container/SideNav/menuItems.ts
@@ -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['items'][number][];
}
export default menus;