import React, {Component} from 'react';

import {Layout, Menu} from 'antd';
import Metabase from "./metabase/Metabase";


const { Content } = Layout;

class DataAnalysis extends Component {
    constructor() {
        super();
        this.state = {
            menuLevel2: "metabase",
        }
    }

    switchMenu = (menuName, e) => {
        console.log('menuName', menuName, 'e', e);
        this.setState({
            [menuName]: e.key,
        });
    };

    render() {
        return (
            <div>
                <Menu
                    mode="horizontal"
                    defaultSelectedKeys={['metabase']}
                    style={{padding: '0 24px', position: 'fixed', width: '100%', zIndex: '1'}}
                    onClick={(e) => this.switchMenu('menuLevel2', e)}
                    selectedKeys={[this.state.menuLevel2]}
                >
                    <Menu.Item key="metabase">metabase</Menu.Item>
                </Menu>

                <Layout style={{ padding: '24px', zIndex: '0'}}>
                    <Content style={{ padding: '24px', minHeight: 280, background: '#fff',marginTop: '48px'  }}>
                        {(() => {
                            switch (this.state.menuLevel2) {
                                case 'metabase':
                                    return <Metabase />;
                                default:
                                    return <Metabase />
                            }
                        })()}
                    </Content>
                </Layout>
            </div>
        )
    }
}

export default DataAnalysis;