"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.FeedbackBanner = void 0;
var _react = _interopRequireDefault(require("react"));
var _styledComponents = _interopRequireDefault(require("styled-components"));
var _ = require("../..");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var getBorderColor = function getBorderColor(_ref) {
  var variant = _ref.variant,
    theme = _ref.theme;
  switch (variant) {
    case 'error':
      return theme.color.functionRed;
    case 'warning':
      return theme.color.functionYellow;
    case 'success':
      return theme.color.functionGreen;
    case 'info':
    default:
      return theme.color.cta;
  }
};
var getIcon = function getIcon(variant) {
  switch (variant) {
    case 'error':
      return _react.default.createElement(_.OldIcon.CrossCircle, {
        size: 5,
        fill: function fill(t) {
          return t.color.functionRed;
        }
      });
    case 'warning':
      return _react.default.createElement(_.OldIcon.WarningTriangle, {
        size: 5,
        fill: function fill(t) {
          return t.color.functionYellow;
        }
      });
    case 'success':
      return _react.default.createElement(_.OldIcon.CheckMarkCircle, {
        size: 5,
        fill: function fill(t) {
          return t.color.functionGreen;
        }
      });
    case 'info':
    default:
      return _react.default.createElement(_.OldIcon.InfoCircle, {
        size: 5,
        fill: function fill(t) {
          return t.color.cta;
        }
      });
  }
};
var StyledContainer = _styledComponents.default.div.withConfig({
  displayName: "FeedbackBanner__StyledContainer",
  componentId: "sc-1q6qf62-0"
})(["background-color:", ";border-left:", "px solid ", ";padding:", ";box-sizing:border-box;border-radius:", ";"], function (_ref2) {
  var theme = _ref2.theme,
    scope = _ref2.scope;
  return theme.color[scope === 'module' ? 'feedbackModuleBackground' : 'feedbackPageBackground'];
}, function (p) {
  return p.theme.spacing.unit(1);
}, getBorderColor, function (p) {
  return "".concat(p.theme.spacing.unit(1), "px ").concat(p.theme.spacing.unit(3), "px");
}, function (p) {
  return p.theme.borderRadius4;
});
var TextFlexbox = (0, _styledComponents.default)(_.Flexbox).withConfig({
  displayName: "FeedbackBanner__TextFlexbox",
  componentId: "sc-1q6qf62-1"
})(["width:100%;"]);
var FeedbackBanner = exports.FeedbackBanner = function FeedbackBanner(_ref3) {
  var _ref3$variant = _ref3.variant,
    variant = _ref3$variant === void 0 ? 'info' : _ref3$variant,
    _ref3$scope = _ref3.scope,
    scope = _ref3$scope === void 0 ? 'module' : _ref3$scope,
    title = _ref3.title,
    _ref3$withIcon = _ref3.withIcon,
    withIcon = _ref3$withIcon === void 0 ? true : _ref3$withIcon,
    children = _ref3.children,
    className = _ref3.className;
  return _react.default.createElement(StyledContainer, {
    className: className,
    variant: variant,
    scope: scope
  }, _react.default.createElement(_.Flexbox, {
    container: true,
    direction: "row",
    alignItems: "center",
    gap: 3
  }, withIcon && _react.default.createElement(_react.default.Fragment, null, getIcon(variant)), _react.default.createElement(TextFlexbox, {
    container: true,
    item: true,
    direction: "column"
  }, title && _react.default.createElement(_.Typography, {
    type: "secondary",
    weight: "bold"
  }, title), _react.default.createElement(_.Typography, {
    type: "secondary"
  }, children))));
};