mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-12 22:08:59 +08:00
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:
parent
da4cbf6c2f
commit
c3763032df
@ -98,7 +98,7 @@ function SideNav(): JSX.Element {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const items = [
|
const items = [
|
||||||
...menus.map(({ to, Icon, name, tags }) => ({
|
...menus.map(({ to, Icon, name, tags, children }) => ({
|
||||||
key: to,
|
key: to,
|
||||||
icon: <Icon />,
|
icon: <Icon />,
|
||||||
onClick: (): void => onClickHandler(to),
|
onClick: (): void => onClickHandler(to),
|
||||||
@ -113,6 +113,7 @@ function SideNav(): JSX.Element {
|
|||||||
))}
|
))}
|
||||||
</Space>
|
</Space>
|
||||||
),
|
),
|
||||||
|
children,
|
||||||
})),
|
})),
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -129,7 +130,7 @@ function SideNav(): JSX.Element {
|
|||||||
theme="dark"
|
theme="dark"
|
||||||
defaultSelectedKeys={[ROUTES.APPLICATION]}
|
defaultSelectedKeys={[ROUTES.APPLICATION]}
|
||||||
selectedKeys={currentMenu ? [currentMenu?.to] : []}
|
selectedKeys={currentMenu ? [currentMenu?.to] : []}
|
||||||
mode="inline"
|
mode="vertical"
|
||||||
style={styles}
|
style={styles}
|
||||||
items={items}
|
items={items}
|
||||||
/>
|
/>
|
||||||
|
@ -10,6 +10,7 @@ import {
|
|||||||
MenuOutlined,
|
MenuOutlined,
|
||||||
SettingOutlined,
|
SettingOutlined,
|
||||||
} from '@ant-design/icons';
|
} from '@ant-design/icons';
|
||||||
|
import type { MenuProps } from 'antd';
|
||||||
import ROUTES from 'constants/routes';
|
import ROUTES from 'constants/routes';
|
||||||
|
|
||||||
const menus: SidebarMenu[] = [
|
const menus: SidebarMenu[] = [
|
||||||
@ -28,6 +29,12 @@ const menus: SidebarMenu[] = [
|
|||||||
to: ROUTES.LOGS,
|
to: ROUTES.LOGS,
|
||||||
name: 'Logs',
|
name: 'Logs',
|
||||||
// tags: ['Beta'],
|
// tags: ['Beta'],
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
key: ROUTES.LOGS,
|
||||||
|
label: 'Search',
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Icon: DashboardFilled,
|
Icon: DashboardFilled,
|
||||||
@ -71,6 +78,7 @@ interface SidebarMenu {
|
|||||||
name: string;
|
name: string;
|
||||||
Icon: typeof ApiOutlined;
|
Icon: typeof ApiOutlined;
|
||||||
tags?: string[];
|
tags?: string[];
|
||||||
|
children?: Required<MenuProps>['items'][number][];
|
||||||
}
|
}
|
||||||
|
|
||||||
export default menus;
|
export default menus;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user