import Drawer from '..';
import React from 'react';
import ReactDOM from 'react-dom';
import { Button } from '../..';

class App extends React.Component {
  state = { visible: false, childrenDrawer: false };

  showDrawer = () => {
    this.setState({
      visible: true,
    });
  };

  onClose = () => {
    this.setState({
      visible: false,
    });
  };

  showChildrenDrawer = () => {
    this.setState({
      childrenDrawer: true,
    });
  };

  onChildrenDrawerClose = () => {
    this.setState({
      childrenDrawer: false,
    });
  };

  render() {
    return (
      <div>
        <Button type="primary" onClick={this.showDrawer}>
          Open drawer
        </Button>
        <Drawer
          title="Multi-level drawer"
          closeMode={'mask'}
          size = 'small'
          onClose={this.onClose}
          footer
          footerAlign = "right"
          visible={this.state.visible}
        >
          <Button type="primary" onClick={this.showChildrenDrawer}>
                Two-level drawer
          </Button>
          <div style={{ height: 800, marginTop: 40 }}>很长的内容</div>
          <div style={{ marginBottom: 40 }}>底部的内容123</div>

          <Drawer
            multilevel
            title="Two-level Drawer"
            closeMode={'mask'}
            size = 'small'
            footer
            footerAlign = "center"
            onClose={this.onChildrenDrawerClose}
            visible={this.state.childrenDrawer}
          >
             Start your business here by searching a popular product
            <div><p>很长的内容</p><p>很长的内容</p><p>很长的内容</p><p>很长的内容</p><p>很长的内容</p><p>很长的内容</p><p>很长的内容</p><p>很长的内容</p><p>很长的内容</p><p>很长的内容</p><p>很长的内容</p><p>很长的内容</p><p>很长的内容</p><p>很长的内容</p><p>很长的内容</p><p>很长的内容</p><p>很长的内容</p><p>很长的内容</p><p>很长的内容</p><p>很长的内容</p><p>很长的内容</p><p>很长的内容</p><p>很长的内容</p><p>很长的内容</p><p>很长的内容</p><p>很长的内容</p><p>很长的内容</p><p>很长的内容</p><p>11111 </p></div>
          </Drawer>
        </Drawer>
      </div>
    );
  }
}

ReactDOM.render(<App />, document.getElementById('drawer-demo-3'));
