"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.colorTokens.error.background_medium;
    case 'warning':
      return theme.colorTokens.warning.background_default;
    case 'success':
      return theme.colorTokens.positive.background_default;
    case 'info':
    default:
      return theme.colorTokens.action.background_default;
  }
};
var getIcon = function getIcon(variant) {
  switch (variant) {
    case 'error':
      return _react.default.createElement(_.Icon.ErrorFill24, {
        color: function color(t) {
          return t.colorTokens.error.icon_default;
        }
      });
    case 'warning':
      return _react.default.createElement(_.Icon.WarningFill24, {
        color: function color(t) {
          return t.colorTokens.warning.icon_default;
        }
      });
    case 'success':
      return _react.default.createElement(_.Icon.CheckCircleFill24, {
        color: function color(t) {
          return t.colorTokens.positive.icon_default;
        }
      });
    case 'info':
    default:
      return _react.default.createElement(_.Icon.InformationFill24, {
        color: function color(t) {
          return t.colorTokens.action.icon_default;
        }
      });
  }
};
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 scope === 'module' ? theme.colorTokens.neutral.background_medium : theme.colorTokens.neutral.background_default;
}, function (p) {
  return p.theme.spacing.unit(1);
}, getBorderColor, function (_ref3) {
  var theme = _ref3.theme;
  return "".concat(theme.spacing.unit(1), "px ").concat(theme.spacing.unit(3), "px");
}, function (_ref4) {
  var theme = _ref4.theme;
  return theme.borderRadius4;
});
var TextFlexbox = (0, _styledComponents.default)(_.Flexbox).withConfig({
  displayName: "FeedbackBanner__TextFlexbox",
  componentId: "sc-1q6qf62-1"
})(["width:100%;"]);
var FeedbackBanner = exports.FeedbackBanner = function FeedbackBanner(_ref5) {
  var _ref5$variant = _ref5.variant,
    variant = _ref5$variant === void 0 ? 'info' : _ref5$variant,
    _ref5$scope = _ref5.scope,
    scope = _ref5$scope === void 0 ? 'module' : _ref5$scope,
    title = _ref5.title,
    _ref5$withIcon = _ref5.withIcon,
    withIcon = _ref5$withIcon === void 0 ? true : _ref5$withIcon,
    children = _ref5.children,
    className = _ref5.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))));
};