import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { Nav, NavItem, IndexNavItem } from 'amos-framework';


class BizNav extends Component {
  static propTypes = {};

  constructor(props) {
    super(props);
    this.state = {
      visible: false
    };
  }

  componentDidMount() {

  }

  onClick = (es) => {

  };
  renderNavItem = (subMenus = []) => {
    return subMenus.map((sbm, index) => {
      if (index === 0) {
        return <IndexNavItem key={sbm.sequenceNbr} onClick={e => this.onClick(sbm)} icon={sbm.icon} title={sbm.permissionName} href={sbm.path} />;
      } else {
        return <NavItem key={sbm.sequenceNbr} onClick={e => this.onClick(sbm)} icon={sbm.icon} title={sbm.permissionName} href={sbm.path} />;
      }
    });
  };

  render() {
    let { submenu } = this.props;
    const navItem = this.renderNavItem(submenu);
    return (
      <div className="top-header">
        <Nav direction="horizontal" href="/">
          {navItem}
        </Nav>
        <div className="top-right">
          <div>

          </div>
        </div>
      </div>
    );
  }
}
BizNav.propTypes = {
  submenu: PropTypes.array
};
export default BizNav;
