style: flatten menu items

This commit is contained in:
jialin
2025-07-10 09:47:12 +08:00
parent 751ddbb3f3
commit 51450c2b02
23 changed files with 1052 additions and 553 deletions
+29 -30
View File
@@ -20,23 +20,14 @@ import { Avatar, Menu, Spin } from 'antd';
import _ from 'lodash';
import React from 'react';
const themeConfig = [
{
key: 'realDark',
label: 'common.appearance.dark',
icon: <MoonOutlined />
},
{
key: 'light',
label: 'common.appearance.light',
icon: <SunOutlined />
}
// {
// key: 'auto',
// label: 'common.appearance.system',
// icon: <IconFont type="icon-theme-auto" />
// }
];
const getMenuStyle = (
collapsed: boolean,
siderWidth: number,
extraStyle: React.CSSProperties = {}
) => ({
width: collapsed ? 40 : `calc(${siderWidth}px - 16px)`,
...extraStyle
});
export const getRightRenderContent = (opts: {
runtimeConfig: any;
@@ -300,6 +291,20 @@ export const getRightRenderContent = (opts: {
</span>
),
children: [
{
key: 'apikeys',
label: (
<span className="flex flex-center">
<IconFont type="icon-key" />
<span className="m-l-8" style={{ marginLeft: 8 }}>
{intl?.formatMessage?.({ id: 'menu.apikeys' })}
</span>
</span>
),
onClick: () => {
history.push('/api-keys');
}
},
{
key: 'settings',
label: (
@@ -333,23 +338,17 @@ export const getRightRenderContent = (opts: {
]
};
const getMenuStyle = (
collapsed: boolean,
siderWidth: number,
extraStyle: React.CSSProperties = {}
) => ({
width: collapsed ? 40 : `calc(${siderWidth}px - 16px)`,
...extraStyle
});
return (
<div>
<>
<Menu {...helpMenu} style={getMenuStyle(collapsed, siderWidth)} />
<Menu {...langMenu} style={getMenuStyle(collapsed, siderWidth)} />
{/* <Menu {...langMenu} style={getMenuStyle(collapsed, siderWidth)} /> */}
<Menu
{...userMenu}
style={getMenuStyle(collapsed, siderWidth, { marginTop: 20 })}
style={getMenuStyle(collapsed, siderWidth, {
marginTop: 8,
marginBottom: 0
})}
/>
</div>
</>
);
};