"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.InlineIcon = InlineIcon;

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

var _images = require("../../assets/images");

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

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

function InlineIcon(_ref) {
  var icon = _ref.icon,
      _ref$provideScreenRea = _ref.provideScreenReaderFallback,
      provideScreenReaderFallback = _ref$provideScreenRea === void 0 ? true : _ref$provideScreenRea,
      className = _ref.className,
      svgProps = _ref.svgProps;
  var text;
  var iconComponent; // TODO: why are arrowdown and anglearrowdown basically the same?
  // Revisit when we decide this vs textwithicon

  switch (icon) {
    case 'attentionNeeded':
      text = 'attention needed';
      iconComponent = /*#__PURE__*/_react.default.createElement(_images.Error, svgProps);
      break;

    case 'complete':
      text = 'complete';
      iconComponent = /*#__PURE__*/_react.default.createElement(_images.Success, svgProps);
      break;

    case 'incomplete':
      text = 'incomplete';
      iconComponent = /*#__PURE__*/_react.default.createElement(_images.Error, svgProps);
      break;

    case 'arrowDown':
      text = 'select dropdown';
      iconComponent = /*#__PURE__*/_react.default.createElement(_images.ArrowDown, svgProps);
      break;

    case 'angleArrowDown':
      text = 'select dropdown';
      iconComponent = /*#__PURE__*/_react.default.createElement(_images.AngleArrowDown, svgProps);
      break;

    default:
      text = '';
      iconComponent = /*#__PURE__*/_react.default.createElement(_images.Info, null);
  }

  return /*#__PURE__*/_react.default.createElement("span", {
    className: (0, _classnames.default)(className, 'oec-inline-icon', "oec-inline-icon--".concat(icon))
  }, iconComponent, provideScreenReaderFallback && /*#__PURE__*/_react.default.createElement("span", {
    className: (0, _classnames.default)('usa-sr-only')
  }, "(", text, ")"));
}