"use strict";var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;exports.__esModule = true;exports.LinkIcon = void 0;var _react = _interopRequireWildcard(require("react"));

var _Emotion = require("../../lib/theming/Emotion");
var _ThemeContext = require("../../lib/theming/ThemeContext");
var _Spinner = require("../Spinner");


var _Link = require("./Link.styles");






var LinkIcon = exports.LinkIcon = function LinkIcon(_ref) {var icon = _ref.icon,loading = _ref.loading,hasBothIcons = _ref.hasBothIcons,position = _ref.position;
  var theme = (0, _react.useContext)(_ThemeContext.ThemeContext);

  return /*#__PURE__*/(
    _react.default.createElement("span", {
      className: (0, _Emotion.cx)(
        _Link.styles.icon(),
        position === 'left' && _Link.styles.iconLeft(theme),
        position === 'right' && _Link.styles.iconRight(theme)
      ) },

    loading && !hasBothIcons ? /*#__PURE__*/_react.default.createElement(_Spinner.Spinner, { caption: null, dimmed: true, inline: true }) : icon
    ));

};