index.js 698 Bytes
Newer Older
1
import 'rc-drawer/assets/index.css';
2
import React from 'react';
3
import DrawerMenu from 'rc-drawer';
jiang's avatar
jiang committed
4
import SiderMenu from './SiderMenu';
偏右's avatar
偏右 committed
5

6 7 8
const SiderMenuWrapper = props => {
  const { isMobile, collapsed } = props;
  return isMobile ? (
9
    <DrawerMenu
10
      getContainer={null}
11
      level={null}
12 13
      handleChild={<i className="drawer-handle-icon" />}
      onHandleClick={() => {
14
        props.onCollapse(!collapsed);
15
      }}
16
      open={!collapsed}
jim's avatar
jim committed
17 18 19
      onMaskClick={() => {
        props.onCollapse(true);
      }}
20
    >
21
      <SiderMenu {...props} collapsed={isMobile ? false : collapsed} />
22
    </DrawerMenu>
jim's avatar
jim committed
23 24 25
  ) : (
    <SiderMenu {...props} />
  );
26
};
ZHAO Jinxiang's avatar
ZHAO Jinxiang committed
27 28

export default SiderMenuWrapper;