style: menu

This commit is contained in:
jialin
2026-05-29 18:04:31 +08:00
committed by jialin
parent fcd1d01e83
commit 29c5987bf1
3 changed files with 117 additions and 107 deletions
+4 -2
View File
@@ -54,7 +54,8 @@ export default {
itemHoverColor: 'rgba(0,0,0,1)', itemHoverColor: 'rgba(0,0,0,1)',
itemColor: 'rgba(0,0,0,1)', itemColor: 'rgba(0,0,0,1)',
itemHoverBg: 'rgb(24 25 27)', itemHoverBg: 'rgb(24 25 27)',
itemActiveBg: 'rgb(24 25 27)' itemActiveBg: 'rgb(24 25 27)',
menuItemSelectedBg: '#292929'
}, },
Progress: { Progress: {
lineBorderRadius: 4 lineBorderRadius: 4
@@ -108,6 +109,7 @@ export default {
fontSize: 14, fontSize: 14,
motion: true, motion: true,
colorFill: '#0A0A0A', colorFill: '#0A0A0A',
colorBgBase: '#0A0A0A' colorBgBase: '#0A0A0A',
menuItemSelectedBg: '#292929'
} }
}; };
+2 -1
View File
@@ -56,7 +56,8 @@ export default {
itemHoverColor: 'rgba(0,0,0,1)', itemHoverColor: 'rgba(0,0,0,1)',
itemColor: 'rgba(0,0,0,1)', itemColor: 'rgba(0,0,0,1)',
itemHoverBg: 'rgba(0,0,0,0.04)', itemHoverBg: 'rgba(0,0,0,0.04)',
itemActiveBg: 'rgba(0,0,0,0.04)' itemActiveBg: 'rgba(0,0,0,0.04)',
menuItemSelectedBg: 'rgba(255, 255, 255, 0.9)'
}, },
Progress: { Progress: {
lineBorderRadius: 3 lineBorderRadius: 3
+13 -6
View File
@@ -2,7 +2,7 @@ import { CaretDownOutlined } from '@ant-design/icons';
import { IconFont } from '@gpustack/core-ui'; import { IconFont } from '@gpustack/core-ui';
import { Link, useLocation } from '@umijs/max'; import { Link, useLocation } from '@umijs/max';
import { Tooltip } from 'antd'; import { Tooltip } from 'antd';
import { createStyles } from 'antd-style'; import { createStyles, type FullToken } from 'antd-style';
import React, { useMemo, useState } from 'react'; import React, { useMemo, useState } from 'react';
interface MenuItem { interface MenuItem {
@@ -20,7 +20,8 @@ interface SiderMenuProps {
initialState: Global.InitialStateType; initialState: Global.InitialStateType;
} }
const useStyles = createStyles(({ css, token }) => { const useStyles = createStyles(
({ css, token }: { css: any; token: FullToken }) => {
console.log('useStyles', token); console.log('useStyles', token);
// @ts-ignore // @ts-ignore
@@ -42,6 +43,7 @@ const useStyles = createStyles(({ css, token }) => {
cursor: pointer; cursor: pointer;
white-space: nowrap; white-space: nowrap;
padding: var(--ant-padding-xs) var(--ant-padding); padding: var(--ant-padding-xs) var(--ant-padding);
padding-left: 0px;
font-size: 12px; font-size: 12px;
padding-bottom: 4px; padding-bottom: 4px;
overflow: hidden; overflow: hidden;
@@ -59,7 +61,7 @@ const useStyles = createStyles(({ css, token }) => {
align-items: center; align-items: center;
gap: 4px; gap: 4px;
font-size: 12px; font-size: 12px;
color: var(--ant-color-text-tertiary); color: var(--ant-color-text);
font-weight: 400; font-weight: 400;
} }
@@ -90,13 +92,17 @@ const useStyles = createStyles(({ css, token }) => {
height: ${Menu.itemHeight}px; height: ${Menu.itemHeight}px;
line-height: ${Menu.itemHeight}px; line-height: ${Menu.itemHeight}px;
color: var(--ant-color-text-tertiary); color: var(--ant-color-text-tertiary);
border-radius: ${Menu.itemBorderRadius}px;
border: 1px solid transparent;
&:hover { &:hover {
background-color: ${Menu.itemHoverBg}; background-color: ${Menu.itemHoverBg};
color: ${Menu.itemHoverColor}; color: ${Menu.itemHoverColor};
} }
&.menu-item-selected { &.menu-item-selected {
background-color: ${Menu.itemSelectedBg}; background-color: ${Menu.menuItemSelectedBg};
color: ${Menu.itemSelectedColor}; color: ${Menu.itemSelectedColor};
border: 1px solid var(--ant-color-border-secondary);
.anticon { .anticon {
color: ${Menu.itemSelectedColor}; color: ${Menu.itemSelectedColor};
} }
@@ -130,7 +136,8 @@ const useStyles = createStyles(({ css, token }) => {
right: -2px; right: -2px;
` `
}; };
}); }
);
const SiderMenu: React.FC<SiderMenuProps> = (props) => { const SiderMenu: React.FC<SiderMenuProps> = (props) => {
const { menuData, collapsed } = props; const { menuData, collapsed } = props;
@@ -231,10 +238,10 @@ const SiderMenu: React.FC<SiderMenuProps> = (props) => {
> >
{!collapsed ? ( {!collapsed ? (
<span className="group-title-text"> <span className="group-title-text">
<span>{item.name}</span>
<CaretDownOutlined <CaretDownOutlined
rotate={collapseKeys.has(item.key) ? -90 : 0} rotate={collapseKeys.has(item.key) ? -90 : 0}
></CaretDownOutlined> ></CaretDownOutlined>
<span>{item.name}</span>
</span> </span>
) : ( ) : (
<span className={styles.line}></span> <span className={styles.line}></span>