"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

exports.__esModule = true;
exports.HeaderIcon = void 0;

var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));

var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));

var _react = _interopRequireDefault(require("react"));

var _propTypes = _interopRequireDefault(require("prop-types"));

var _lodash = _interopRequireDefault(require("lodash"));

var _classnames2 = _interopRequireDefault(require("classnames"));

var HeaderIcon =
/*#__PURE__*/
function (_React$Component) {
  (0, _inheritsLoose2.default)(HeaderIcon, _React$Component);

  function HeaderIcon() {
    return _React$Component.apply(this, arguments) || this;
  }

  var _proto = HeaderIcon.prototype;

  _proto.render = function render() {
    var _classnames;

    var className = (0, _classnames2.default)('header-icon', (_classnames = {}, _classnames[this.props.imageClass] = !_lodash.default.isEmpty(this.props.imageClass), _classnames));
    return _react.default.createElement("div", {
      "data-test-automation-id": "headerIcon",
      className: className
    }, this.props.children);
  };

  return HeaderIcon;
}(_react.default.Component);

exports.HeaderIcon = HeaderIcon;
(0, _defineProperty2.default)(HeaderIcon, "propTypes", {
  imageClass: _propTypes.default.string,
  children: function children(props, propName, componentName) {
    var children = props[propName];

    var count = _react.default.Children.count(children);

    if (count > 0 && (count !== 1 || children.type.name !== 'Icon')) {
      return new Error("Only a Icon component is allowed in the body of the " + componentName + ".");
    }
  }
});
(0, _defineProperty2.default)(HeaderIcon, "defaultProps", {
  imageClass: '',
  children: null
});