fix(theme): fix color of header menu (#3354)

This commit is contained in:
Zeke Zhang 2024-01-10 09:15:41 +08:00 committed by GitHub
parent 0ce0ca6441
commit 70633840da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 64 additions and 10 deletions

View File

@ -31,7 +31,7 @@ export const PinnedPluginList = () => {
width: 46px;
border-radius: 0;
background: none;
color: rgba(255, 255, 255, 0.65) !important;
color: rgba(255, 255, 255, 0.65);
&:hover {
background: rgba(255, 255, 255, 0.1);
}

View File

@ -1,6 +1,7 @@
import { css } from '@emotion/css';
import { useSessionStorageState } from 'ahooks';
import { App, Layout } from 'antd';
import { createGlobalStyle } from 'antd-style';
import React, { createContext, useContext, useEffect, useMemo, useRef, useState } from 'react';
import { Link, Outlet, useMatch, useNavigate, useParams } from 'react-router-dom';
import {
@ -193,6 +194,44 @@ const MenuEditor = (props) => {
);
};
/**
*
*/
const GlobalStyleForAdminLayout = createGlobalStyle`
.ant-menu.ant-menu-submenu.ant-menu-submenu-popup {
.ant-menu.ant-menu-sub.ant-menu-vertical {
background-color: ${(p) => {
// @ts-ignore
return p.theme.colorBgHeader + ' !important';
}};
color: ${(p) => {
// @ts-ignore
return p.theme.colorTextHeaderMenu + ' !important';
}};
.ant-menu-item:hover {
color: ${(p) => {
// @ts-ignore
return p.theme.colorTextHeaderMenuHover + ' !important';
}};
background-color: ${(p) => {
// @ts-ignore
return p.theme.colorBgHeaderMenuHover + ' !important';
}};
}
.ant-menu-item.ant-menu-item-selected {
color: ${(p) => {
// @ts-ignore
return p.theme.colorTextHeaderMenuActive + ' !important';
}};
background-color: ${(p) => {
// @ts-ignore
return p.theme.colorBgHeaderMenuActive + ' !important';
}};
}
}
}
`;
export const InternalAdminLayout = (props: any) => {
const sideMenuRef = useRef<HTMLDivElement>();
const result = useSystemSettings();
@ -203,17 +242,18 @@ export const InternalAdminLayout = (props: any) => {
return (
<Layout>
<GlobalStyleForAdminLayout />
<Layout.Header
className={css`
.ant-menu.ant-menu-dark .ant-menu-item-selected,
.ant-menu-submenu-popup.ant-menu-dark .ant-menu-item-selected,
.ant-menu-submenu-horizontal.ant-menu-submenu-selected {
background-color: ${token.colorBgHeaderMenuActive};
color: ${token.colorTextHeaderMenuActive};
background-color: ${token.colorBgHeaderMenuActive} !important;
color: ${token.colorTextHeaderMenuActive} !important;
}
.ant-menu-dark.ant-menu-horizontal > .ant-menu-item:hover {
background-color: ${token.colorBgHeaderMenuHover};
color: ${token.colorTextHeaderMenuHover};
background-color: ${token.colorBgHeaderMenuHover} !important;
color: ${token.colorTextHeaderMenuHover} !important;
}
position: fixed;
@ -223,14 +263,15 @@ export const InternalAdminLayout = (props: any) => {
line-height: var(--nb-header-height);
padding: 0;
z-index: 100;
background-color: ${token.colorBgHeader};
background-color: ${token.colorBgHeader} !important;
.ant-menu {
background-color: transparent;
}
.ant-menu-item {
color: ${token.colorTextHeaderMenu};
.ant-menu-item,
.ant-menu-submenu-horizontal {
color: ${token.colorTextHeaderMenu} !important;
}
`}
>

View File

@ -18,9 +18,9 @@ import { createDesignable, DndContext, SortableItem, useDesignable, useDesigner
import { Icon, useAPIClient, useSchemaInitializerRender } from '../../../';
import { useCollectMenuItems, useMenuItem } from '../../../hooks/useMenuItem';
import { useProps } from '../../hooks/useProps';
import { useMenuTranslation } from './locale';
import { MenuDesigner } from './Menu.Designer';
import { findKeysByUid, findMenuItem } from './util';
import { useMenuTranslation } from './locale';
const subMenuDesignerCss = css`
position: relative;

View File

@ -11,6 +11,7 @@
"@formily/react": "2.x",
"@formily/shared": "2.x",
"antd": "5.x",
"antd-style": "3.x",
"async-mutex": "^0.3.2",
"mysql2": "^2.3.3",
"pg": "^8.7.3",

View File

@ -0,0 +1,10 @@
import { createStyles } from 'antd-style';
export const useStyles = createStyles(({ token }) => {
return {
button: {
// @ts-ignore
color: token.colorTextHeaderMenu + ' !important',
},
};
});

View File

@ -3,9 +3,11 @@ import { Button, Dropdown } from 'antd';
import React from 'react';
import { Link } from 'react-router-dom';
import { AppNameInput } from './AppNameInput';
import { useStyles } from './MultiAppManagerProvider.style';
import { usePluginUtils } from './utils';
const MultiAppManager = () => {
const { styles } = useStyles();
const { data, run } = useRequest<{
data: any[];
}>(
@ -46,7 +48,7 @@ const MultiAppManager = () => {
}}
menu={{ items }}
>
<Button title={'Apps'} icon={<Icon type={'AppstoreOutlined'} />} />
<Button className={styles.button} title={'Apps'} icon={<Icon type={'AppstoreOutlined'} />} />
</Dropdown>
);
};