Skip to content

Commit

Permalink
fix(layout):fix drawer bgColor error
Browse files Browse the repository at this point in the history
  • Loading branch information
chenshuai2144 committed Mar 27, 2023
1 parent 7d1891f commit 907bead
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
15 changes: 12 additions & 3 deletions packages/layout/src/components/SiderMenu/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { ProProvider } from '@ant-design/pro-provider';
import { openVisibleCompatible } from '@ant-design/pro-utils';
import { ConfigProvider, Drawer } from 'antd';
import classNames from 'classnames';
import Omit from 'omit.js';
import React, { useEffect } from 'react';
import React, { useContext, useEffect } from 'react';
import type { PrivateSiderMenuProps, SiderMenuProps } from './SiderMenu';
import { SiderMenu } from './SiderMenu';
import { useStyle } from './style/index';
Expand All @@ -16,10 +17,12 @@ const SiderMenuWrapper: React.FC<SiderMenuProps & PrivateSiderMenuProps> = (prop
style,
className,
hide,
getContainer,
getContainer = false,
prefixCls,
} = props;

const { token } = useContext(ProProvider);

useEffect(() => {
if (isMobile === true) {
onCollapse?.(true);
Expand Down Expand Up @@ -61,7 +64,13 @@ const SiderMenuWrapper: React.FC<SiderMenuProps & PrivateSiderMenuProps> = (prop
closable={false}
getContainer={getContainer}
width={siderWidth}
bodyStyle={{ height: '100vh', padding: 0, display: 'flex', flexDirection: 'row' }}
bodyStyle={{
height: '100vh',
padding: 0,
display: 'flex',
flexDirection: 'row',
backgroundColor: token?.layout?.sider?.colorMenuBackground,
}}
>
<SiderMenu
{...omitProps}
Expand Down
8 changes: 4 additions & 4 deletions tests/layout/__snapshots__/mobile.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ exports[`mobile BasicLayout 📱 base use 1`] = `
>
<div
class="ant-drawer-body"
style="height: 100vh; padding: 0px; display: flex; flex-direction: row;"
style="height: 100vh; padding: 0px; display: flex; flex-direction: row; background-color: transparent;"
>
<aside
class="ant-layout-sider ant-layout-sider-dark ant-pro-sider ant-pro-sider-fixed ant-pro-sider-light"
Expand Down Expand Up @@ -306,7 +306,7 @@ exports[`mobile BasicLayout 📱 collapsed=false 1`] = `
>
<div
class="ant-drawer-body"
style="height: 100vh; padding: 0px; display: flex; flex-direction: row;"
style="height: 100vh; padding: 0px; display: flex; flex-direction: row; background-color: transparent;"
>
<aside
class="ant-layout-sider ant-layout-sider-dark ant-pro-sider ant-pro-sider-fixed ant-pro-sider-light"
Expand Down Expand Up @@ -781,7 +781,7 @@ exports[`mobile BasicLayout 📱 layout=mix 1`] = `
>
<div
class="ant-drawer-body"
style="height: 100vh; padding: 0px; display: flex; flex-direction: row;"
style="height: 100vh; padding: 0px; display: flex; flex-direction: row; background-color: transparent;"
>
<aside
class="ant-layout-sider ant-layout-sider-dark ant-pro-sider ant-pro-sider-fixed ant-pro-sider-light"
Expand Down Expand Up @@ -1069,7 +1069,7 @@ exports[`mobile BasicLayout 📱 layout=mix and splitMenus 1`] = `
>
<div
class="ant-drawer-body"
style="height: 100vh; padding: 0px; display: flex; flex-direction: row;"
style="height: 100vh; padding: 0px; display: flex; flex-direction: row; background-color: transparent;"
>
<aside
class="ant-layout-sider ant-layout-sider-dark ant-pro-sider ant-pro-sider-fixed ant-pro-sider-light"
Expand Down

0 comments on commit 907bead

Please sign in to comment.