import React, { useContext } from 'react';
import { cx } from "../../../lib/theming/Emotion";
import { ThemeContext } from "../../../lib/theming/ThemeContext";
import { Spinner } from "../../Spinner";
import { styles } from "../Link.styles";
export var LinkIcon = function LinkIcon(_ref) {
  var icon = _ref.icon,
    loading = _ref.loading,
    hasBothIcons = _ref.hasBothIcons,
    position = _ref.position;
  var theme = useContext(ThemeContext);
  return /*#__PURE__*/(
    React.createElement("span", {
      className: cx(styles.icon(), position === 'left' && styles.iconLeft(theme), position === 'right' && styles.iconRight(theme))
    }, loading && !hasBothIcons ? /*#__PURE__*/React.createElement(Spinner, {
      caption: null,
      dimmed: true,
      inline: true
    }) : icon)
  );
};