'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

var _getClassName2 = require('babel-plugin-react-css-modules/dist/browser/getClassName');

var _getClassName3 = _interopRequireDefault(_getClassName2);

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

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

var _propTypes2 = _interopRequireDefault(_propTypes);

var _classnames = require('classnames');

var _classnames2 = _interopRequireDefault(_classnames);

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

var _styleModuleImportMap = {
  './item.scss': {
    'container': 'flive_item_container',
    'right': 'flive_item_right',
    'inner-component': 'flive_item_inner-component',
    'bold': 'flive_item_bold',
    'align-right': 'flive_item_align-right'
  }
};

function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }

var Item = function Item(_ref) {
  var className = _ref.className,
      Component = _ref.component,
      InnerComponent = _ref.innerComponent,
      children = _ref.children,
      bold = _ref.bold,
      to = _ref.to,
      href = _ref.href,
      target = _ref.target,
      alignRight = _ref.alignRight,
      props = _objectWithoutProperties(_ref, ['className', 'component', 'innerComponent', 'children', 'bold', 'to', 'href', 'target', 'alignRight']);

  return _react2.default.createElement(
    Component,
    _extends({}, props, {
      className: (className ? className + ' ' : '') + (0, _getClassName3.default)((0, _classnames2.default)('container', { 'align-right': alignRight }), _styleModuleImportMap)
    }),
    _react2.default.createElement(
      InnerComponent,
      {
        to: to,
        href: href,
        target: target,
        className: (0, _getClassName3.default)((0, _classnames2.default)('inner-component', { bold: bold }), _styleModuleImportMap)
      },
      children
    )
  );
};

Item.propTypes = {
  /** @ignore */
  className: _propTypes2.default.string,
  children: _propTypes2.default.node,
  component: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.object, _propTypes2.default.element]),
  innerComponent: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.object, _propTypes2.default.element]),
  bold: _propTypes2.default.bool,
  alignRight: _propTypes2.default.bool,
  to: _propTypes2.default.string,
  target: _propTypes2.default.string,
  href: _propTypes2.default.string
};

Item.defaultProps = {
  className: undefined,
  children: undefined,
  component: 'li',
  innerComponent: 'a',
  bold: false,
  alignRight: false,
  to: undefined,
  target: undefined,
  href: undefined
};

exports.default = Item;
module.exports = exports['default'];