import _css from "@emotion/css";
import { jsx as ___EmotionJSX } from "@emotion/core";

function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }

function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }

function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }

function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }

function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }

function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }

import React from 'react';
import PropTypes from 'prop-types';
import CheckmarkIcon from '../../svgs/icons/checkmark-icon.svg';
import ErrorIcon from '../../svgs/icons/error-icon.svg';
import InfoIcon from '../../svgs/icons/info-icon.svg';
import { BannerContainer, BannerContentContainer, bannerIconStyles } from './style';
var bannerIconMapping = {
  success: CheckmarkIcon,
  danger: ErrorIcon,
  info: InfoIcon
};

var Banner =
/*#__PURE__*/
function (_React$Component) {
  _inherits(Banner, _React$Component);

  function Banner() {
    _classCallCheck(this, Banner);

    return _possibleConstructorReturn(this, _getPrototypeOf(Banner).apply(this, arguments));
  }

  _createClass(Banner, [{
    key: "render",
    value: function render() {
      var _this$props = this.props,
          content = _this$props.content,
          type = _this$props.type,
          onClick = _this$props.onClick;
      var Icon = bannerIconMapping[type];
      return ___EmotionJSX(BannerContainer, {
        bannerType: type,
        onClick: onClick
      }, ___EmotionJSX(BannerContentContainer, null, ___EmotionJSX(Icon, {
        css:
        /*#__PURE__*/
        _css([bannerIconStyles], "label:Banner;" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9zaGFyZWQtY29tcG9uZW50cy9iYW5uZXIvaW5kZXguanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBb0NZIiwiZmlsZSI6Ii4uLy4uLy4uL3NyYy9zaGFyZWQtY29tcG9uZW50cy9iYW5uZXIvaW5kZXguanMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgUmVhY3QgZnJvbSAncmVhY3QnO1xuaW1wb3J0IFByb3BUeXBlcyBmcm9tICdwcm9wLXR5cGVzJztcblxuaW1wb3J0IENoZWNrbWFya0ljb24gZnJvbSAnLi4vLi4vc3Zncy9pY29ucy9jaGVja21hcmstaWNvbi5zdmcnO1xuaW1wb3J0IEVycm9ySWNvbiBmcm9tICcuLi8uLi9zdmdzL2ljb25zL2Vycm9yLWljb24uc3ZnJztcbmltcG9ydCBJbmZvSWNvbiBmcm9tICcuLi8uLi9zdmdzL2ljb25zL2luZm8taWNvbi5zdmcnO1xuaW1wb3J0IHtcbiAgQmFubmVyQ29udGFpbmVyLFxuICBCYW5uZXJDb250ZW50Q29udGFpbmVyLFxuICBiYW5uZXJJY29uU3R5bGVzLFxufSBmcm9tICcuL3N0eWxlJztcblxuY29uc3QgYmFubmVySWNvbk1hcHBpbmcgPSB7XG4gIHN1Y2Nlc3M6IENoZWNrbWFya0ljb24sXG4gIGRhbmdlcjogRXJyb3JJY29uLFxuICBpbmZvOiBJbmZvSWNvbixcbn07XG5cbmNsYXNzIEJhbm5lciBleHRlbmRzIFJlYWN0LkNvbXBvbmVudCB7XG4gIHN0YXRpYyBwcm9wVHlwZXMgPSB7XG4gICAgY29udGVudDogUHJvcFR5cGVzLm5vZGUuaXNSZXF1aXJlZCxcbiAgICB0eXBlOiBQcm9wVHlwZXMub25lT2YoWydzdWNjZXNzJywgJ2RhbmdlcicsICdpbmZvJ10pLmlzUmVxdWlyZWQsXG4gICAgb25DbGljazogUHJvcFR5cGVzLmZ1bmMsXG4gIH07XG5cbiAgcmVuZGVyKCkge1xuICAgIGNvbnN0IHsgY29udGVudCwgdHlwZSwgb25DbGljayB9ID0gdGhpcy5wcm9wcztcbiAgICBjb25zdCBJY29uID0gYmFubmVySWNvbk1hcHBpbmdbdHlwZV07XG5cbiAgICByZXR1cm4gKFxuICAgICAgPEJhbm5lckNvbnRhaW5lclxuICAgICAgICBiYW5uZXJUeXBlPXt0eXBlfVxuICAgICAgICBvbkNsaWNrPXtvbkNsaWNrfVxuICAgICAgPlxuICAgICAgICA8QmFubmVyQ29udGVudENvbnRhaW5lcj5cbiAgICAgICAgICA8SWNvblxuICAgICAgICAgICAgY3NzPXtbYmFubmVySWNvblN0eWxlc119XG4gICAgICAgICAgICBmaWxsPVwiY3VycmVudENvbG9yXCJcbiAgICAgICAgICAvPlxuICAgICAgICAgIHtjb250ZW50fVxuICAgICAgICA8L0Jhbm5lckNvbnRlbnRDb250YWluZXI+XG4gICAgICA8L0Jhbm5lckNvbnRhaW5lcj5cbiAgICApO1xuICB9XG59XG5cbmV4cG9ydCBkZWZhdWx0IEJhbm5lcjtcbiJdfQ== */")),
        fill: "currentColor"
      }), content));
    }
  }]);

  return Banner;
}(React.Component);

Banner.propTypes = {
  content: PropTypes.node.isRequired,
  type: PropTypes.oneOf(['success', 'danger', 'info']).isRequired,
  onClick: PropTypes.func
};
export default Banner;