'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.MenuBar = exports.MenuBarDropdownItem = exports.MenuBarDropdown = exports.MenuBarItem = undefined;

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _propTypes = require('prop-types');

var _propTypes2 = _interopRequireDefault(_propTypes);

var _ramda = require('ramda');

require('./MenuBar.css');

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }

var MenuBarItem = exports.MenuBarItem = function MenuBarItem(_ref) {
  var children = _ref.children;
  return _react2.default.createElement(
    'li',
    null,
    _react2.default.createElement(
      'span',
      { className: 'navbar-menu--title' },
      children
    )
  );
};

var MenuBarDropdown = exports.MenuBarDropdown = function MenuBarDropdown(_ref2) {
  var children = _ref2.children,
      title = _ref2.title,
      open = _ref2.open;
  return _react2.default.createElement(
    'li',
    { className: 'dropdown ' + (open ? 'open' : '') },
    _react2.default.createElement(
      'span',
      { className: 'navbar-menu--title' },
      _react2.default.createElement(
        'a',
        { href: '#', className: 'dropdown-toggle', onClick: function onClick(e) {
            e.preventDefault();
          } },
        title,
        _react2.default.createElement('span', { className: 'caret' })
      )
    ),
    _react2.default.createElement(
      'ul',
      { className: 'dropdown-menu user-menu' },
      children
    )
  );
};
MenuBarDropdown.propTypes = {
  title: _propTypes2.default.string.isRequired,
  open: _propTypes2.default.bool
};

var MenuBarDropdownItem = exports.MenuBarDropdownItem = function MenuBarDropdownItem(_ref3) {
  var children = _ref3.children;
  return _react2.default.createElement(
    'li',
    null,
    children
  );
};

var MenuBar = exports.MenuBar = function MenuBar(_ref4) {
  var children = _ref4.children,
      leftItems = _ref4.leftItems,
      rightItems = _ref4.rightItems,
      onTitleClick = _ref4.onTitleClick;
  return _react2.default.createElement(
    'nav',
    { className: 'navbar navbar-default navbar-container' },
    _react2.default.createElement(
      'div',
      { className: 'container-fluid' },
      _react2.default.createElement(
        'div',
        { className: 'row' },
        _react2.default.createElement(
          'div',
          { className: 'navbar-header navbar-header--logo' },
          _react2.default.createElement('span', { onClick: onTitleClick || (0, _ramda.always)(undefined), className: 'navbar-brand ' + (onTitleClick && 'navbar-brand--button') }),
          _react2.default.createElement('span', { className: 'navbar-divider' }),
          _react.createElement.apply(undefined, ['ul', { className: 'nav navbar-nav' }].concat(_toConsumableArray(leftItems || children || []))),
          _react.createElement.apply(undefined, ['ul', { className: 'nav navbar-nav navbar-right' }].concat(_toConsumableArray(rightItems || [])))
        )
      )
    )
  );
};
MenuBar.propTypes = {
  leftItems: _propTypes2.default.arrayOf(_propTypes2.default.element),
  rightItems: _propTypes2.default.arrayOf(_propTypes2.default.element),
  onTitleClick: _propTypes2.default.func
};