index.js 728 Bytes
Newer Older
1
import React from 'react';
陈帅's avatar
陈帅 committed
2
import { Drawer } from 'antd';
afc163's avatar
afc163 committed
3
import SiderMenu from './SiderMenu';
陈帅's avatar
陈帅 committed
4
import { getFlatMenuKeys } from './SiderMenuUtils';
偏右's avatar
偏右 committed
5

陈帅's avatar
陈帅 committed
6
const SiderMenuWrapper = React.memo(props => {
afc163's avatar
afc163 committed
7
  const { isMobile, menuData, collapsed, onCollapse } = props;
陈帅's avatar
陈帅 committed
8
  const flatMenuKeys = getFlatMenuKeys(menuData);
陈帅's avatar
陈帅 committed
9
  return isMobile ? (
陈帅's avatar
陈帅 committed
10 11 12
    <Drawer
      visible={!collapsed}
      placement="left"
afc163's avatar
afc163 committed
13
      onClose={() => onCollapse(true)}
陈帅's avatar
陈帅 committed
14 15 16 17
      style={{
        padding: 0,
        height: '100vh',
      }}
18
    >
陈帅's avatar
陈帅 committed
19
      <SiderMenu {...props} flatMenuKeys={flatMenuKeys} collapsed={isMobile ? false : collapsed} />
陈帅's avatar
陈帅 committed
20
    </Drawer>
jim's avatar
jim committed
21
  ) : (
陈帅's avatar
陈帅 committed
22
    <SiderMenu {...props} flatMenuKeys={flatMenuKeys} />
jim's avatar
jim committed
23
  );
陈帅's avatar
陈帅 committed
24
});
ZHAO Jinxiang's avatar
ZHAO Jinxiang committed
25 26

export default SiderMenuWrapper;