'use strict';

exports.__esModule = true;

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

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

var _propTypes2 = _interopRequireDefault(_propTypes);

var _ButtonToggle = require('../../atoms/buttons/ButtonToggle');

var _ButtonToggle2 = _interopRequireDefault(_ButtonToggle);

var _SelectBox = require('../../forms/SelectBox');

var _SelectBox2 = _interopRequireDefault(_SelectBox);

var _Tags = require('../../molecules/Tags');

var _Tags2 = _interopRequireDefault(_Tags);

require('./style.css');

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

var ResultsHeading = function ResultsHeading(resultsHeading) {
  var resultsHeadingTotal = resultsHeading.totalResults ? ' of ' + resultsHeading.totalResults + ' for: ' : '';
  var resultsHeadingTitle = 'Showing results ' + resultsHeading.numResults + resultsHeadingTotal;
  var tags = resultsHeading.tags;

  var selectBoxProps = resultsHeading.selectBox;
  var buttonToggleProps = resultsHeading.buttonToggle;
  return _react2.default.createElement(
    'div',
    { className: 'ma__results-heading js-results-heading' },
    _react2.default.createElement(
      'div',
      { className: 'ma__results-heading__container' },
      _react2.default.createElement(
        'div',
        { className: 'ma__results-heading__title' },
        resultsHeadingTitle
      ),
      tags && _react2.default.createElement(_Tags2.default, tags),
      selectBoxProps && _react2.default.createElement(
        'div',
        { className: 'ma__results-heading__sort ma__results-heading__sort-selecBox' },
        _react2.default.createElement(_SelectBox2.default, selectBoxProps)
      ),
      buttonToggleProps && _react2.default.createElement(
        'div',
        { className: 'ma__results-heading__sort' },
        _react2.default.createElement(_ButtonToggle2.default, buttonToggleProps)
      )
    )
  );
};

ResultsHeading.propTypes = process.env.NODE_ENV !== "production" ? {
  /** The range of results being displayed, e.g. 1-10 */
  numResults: _propTypes2.default.string,
  /** The total count of results */
  totalResults: _propTypes2.default.string,
  /** The sort input type as ButtonToggle */
  buttonToggle: _propTypes2.default.shape(_ButtonToggle2.default.props),
  /** The sort input type as SelectBox */
  selecBox: _propTypes2.default.shape(_SelectBox2.default.props),
  /** The array of tags and the tags callback functions */
  tags: _propTypes2.default.shape(_Tags2.default.propTypes)
} : {};

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