import React from 'react';
import classNames from 'classnames';
import FlowSelect from '../../FlowSelect/index';
import SettingsControl from '../../SettingsControl/index';
import ViewSwitch from '../Item/ViewSwitch';
import './ViewSwitchList.less';

var ViewSwitchList = function ViewSwitchList(props) {
  var activeNamespace = props.activeNamespace,
      switches = props.switches,
      toggleSwitch = props.toggleSwitch,
      fireButtonAction = props.fireButtonAction,
      checkedState = props.checkedState,
      disabledState = props.disabledState;
  var leftSide = [],
      rightSide = [];
  switches.forEach(function (item, i) {
    var isLastItem = i === switches.length - 1;
    var side = isLastItem ? rightSide : leftSide;
    side.push(React.createElement("div", {
      className: classNames({
        itemSpacingWrapper: !isLastItem
      }),
      key: item.key
    }, React.createElement(ViewSwitch, {
      itemKey: item.key,
      name: item.name,
      subMenuItems: item.children,
      checkedState: checkedState,
      disabledState: disabledState,
      toggleSwitch: toggleSwitch,
      fireButtonAction: fireButtonAction
    })));
  });
  return React.createElement("div", {
    className: "ViewSwitchList"
  }, React.createElement("div", {
    className: 'side'
  }, leftSide, activeNamespace ? React.createElement(FlowSelect, {
    namespace: activeNamespace
  }) : null), React.createElement("div", {
    className: 'side'
  }, rightSide.concat(React.createElement("div", {
    className: 'settingContainer',
    key: 'setting'
  }, React.createElement("div", {
    className: 'spacer'
  }), React.createElement(SettingsControl, null)))));
};

export default ViewSwitchList;