import React, { Component } from 'react';
import '../content.less';
import LeftTab from './leftTab';
import UserList from './userList';


class Content extends Component {
    constructor() {
        super();
        this.state = {
            loading: false,
            component: <UserList />,
        };
    }

    getKey(key) {
        switch (key) {
            case 'userList':
                require.ensure([], () => {
                    const UserList = require('./userList');
                    this.setState({
                        component: <UserList />,
                    });
                });
                break;
            case 'orgList':
                require.ensure([], () => {
                    const OrgList = require('./orgList');
                    this.setState({
                        component: <OrgList />,
                    });
                });s
                break;
        }
    }
    render() {
        return (
            <div className="manage-content">
                <LeftTab handlekey={this.getKey.bind(this)} />
                <div className="content-right">
                    {this.state.component}
                </div>
            </div>
        )
    }
}

export default Content;
