import _isNil from "lodash/fp/isNil";
import _keys from "lodash/fp/keys";
import React from 'react';
import PropTypes from 'prop-types';
import SsMenuList from '../ssmenu-list';
import style from './style.css';
const buttonStyle = {
  primary: style.primary,
  secondary: style.secondary
};
const MenuList = props => {
  const {
    menuItems = []
  } = props;
  const MenuitemDiv = menuItems.map((item, index) => {
    const {
      title,
      href,
      type,
      subItems,
      outgoing = false,
      onClick
    } = item;
    const subItemsView = !_isNil(subItems) ? /*#__PURE__*/React.createElement("div", {
      className: style.subNav
    }, /*#__PURE__*/React.createElement(SsMenuList, {
      items: item.subItems
    })) : null;
    return /*#__PURE__*/React.createElement("li", {
      key: index,
      className: type ? buttonStyle[type] : style.item
    }, /*#__PURE__*/React.createElement("a", {
      href: href,
      target: outgoing ? '_blank' : '_self',
      onClick: onClick,
      rel: "noreferrer"
    }, title), subItemsView);
  });
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("input", {
    type: "checkbox",
    id: "toggle",
    className: style.toggleBox
  }), /*#__PURE__*/React.createElement("label", {
    htmlFor: "toggle",
    className: style.toggler
  }, "\u2261"), /*#__PURE__*/React.createElement("ul", {
    className: style.list
  }, MenuitemDiv));
};
MenuList.propTypes = process.env.NODE_ENV !== "production" ? {
  menuItems: PropTypes.arrayOf(PropTypes.shape({
    href: PropTypes.string,
    title: PropTypes.string,
    type: PropTypes.oneOf(_keys(buttonStyle)),
    outgoing: PropTypes.bool
  }))
} : {};
export default MenuList;
//# sourceMappingURL=index.js.map