'use strict';

exports.__esModule = 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 _react = require('react');

var _react2 = _interopRequireDefault(_react);

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

var _propTypes2 = _interopRequireDefault(_propTypes);

var _InputText = require('../../forms/InputText');

var _InputText2 = _interopRequireDefault(_InputText);

var _ButtonWithIcon = require('../../atoms/buttons/ButtonWithIcon');

var _ButtonWithIcon2 = _interopRequireDefault(_ButtonWithIcon);

require('./style.css');

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

var SearchBannerForm = function SearchBannerForm(searchBannerForm) {
  var _searchBannerForm$but = searchBannerForm.buttonSearch.classes,
      classes = _searchBannerForm$but === undefined ? [] : _searchBannerForm$but;

  classes = classes.concat(['ma__search-banner__button']);

  return _react2.default.createElement(
    'form',
    { className: 'ma__search-banner__form', action: searchBannerForm.action, onSubmit: searchBannerForm.onSubmit },
    _react2.default.createElement(
      'div',
      { className: 'ma__search-banner__input' },
      _react2.default.createElement(_InputText2.default, searchBannerForm.inputText)
    ),
    _react2.default.createElement(_ButtonWithIcon2.default, _extends({}, searchBannerForm.buttonSearch, { classes: classes }))
  );
};

SearchBannerForm.propTypes = process.env.NODE_ENV !== "production" ? {
  /** The URL to submit form data to */
  action: _propTypes2.default.string,
  /** Custom submit function */
  onSubmit: _propTypes2.default.func,
  /** The properties for the text input field */
  inputText: _propTypes2.default.shape(_InputText2.default.propTypes).isRequired,
  /** The Search button */
  buttonSearch: _propTypes2.default.shape(_ButtonWithIcon2.default.propTypes).isRequired
} : {};

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