docs: fix menu bg (#39649)

This commit is contained in:
MadCcc 2022-12-19 17:22:25 +08:00 committed by GitHub
parent 862231d07b
commit 4714f851d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,6 @@
import React, { useContext } from 'react';
import { useSidebarData } from 'dumi';
import { Affix, Col, Menu } from 'antd';
import { Affix, Col, ConfigProvider, Menu } from 'antd';
import MobileMenu from 'rc-drawer';
import { css } from '@emotion/react';
import SiteContext from '../SiteContext';
@ -131,17 +131,22 @@ const Sidebar: React.FC = () => {
const [menuItems, selectedKey] = useMenu();
const isDark = theme.includes('dark');
const {
token: { colorBgContainer },
} = useSiteToken();
const menuChild = (
<Menu
items={menuItems}
inlineIndent={30}
css={styles.asideContainer}
mode="inline"
theme={isDark ? 'dark' : 'light'}
selectedKeys={[selectedKey]}
defaultOpenKeys={sidebarData?.map(({ title }) => title).filter((item) => item) as string[]}
/>
<ConfigProvider theme={{ components: { Menu: { colorItemBg: colorBgContainer } } }}>
<Menu
items={menuItems}
inlineIndent={30}
css={styles.asideContainer}
mode="inline"
theme={isDark ? 'dark' : 'light'}
selectedKeys={[selectedKey]}
defaultOpenKeys={sidebarData?.map(({ title }) => title).filter((item) => item) as string[]}
/>
</ConfigProvider>
);
return isMobile ? (