import _extends from "@babel/runtime/helpers/extends";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
var _excluded = ["itemArray", "defaultLocation", "__designMode"];
import * as React from 'react';
import { default as List } from "./position-list";
import { default as Position } from "./position-left";
var Navigation = function BottomNavigation(_ref) {
  var itemArray = _ref.itemArray,
    defaultLocation = _ref.defaultLocation,
    __designMode = _ref.__designMode,
    otherProps = _objectWithoutPropertiesLoose(_ref, _excluded);
  var _React$useState = React.useState(defaultLocation),
    current = _React$useState[0],
    _setCurrent = _React$useState[1];
  var _React$useState2 = React.useState(false),
    isOpen = _React$useState2[0],
    setIsOpen = _React$useState2[1];
  var openList = function openList() {
    if (__designMode == 'design') {
      // 设计态不打开列表
      return;
    }
    setIsOpen(!isOpen);
  };
  // React.useEffect(() => {
  //   console.log('defaultLocation', defaultLocation)
  //   if (defaultLocation) {
  //     setCurrent(defaultLocation)
  //   }
  // })
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Position, _extends({
    currentLocation: current
  }, otherProps, {
    clickHandle: function clickHandle() {
      return openList();
    }
  })), /*#__PURE__*/React.createElement(List, {
    open: isOpen,
    currentLocation: current,
    itemArray: itemArray,
    setIsOpen: openList,
    setCurrent: function setCurrent(value) {
      return _setCurrent(value);
    }
  }));
};
export default Navigation;