import React, { useContext } from 'react';
import { useEmotion, useStyles } from '../../lib/renderEnvironment/index.js';
import { ThemeContext } from '../../lib/theming/ThemeContext.js';
import { Spinner } from '../Spinner/index.js';
import { getStyles } from './Link.styles.js';
export var LinkIcon = function (_a) {
    var icon = _a.icon, loading = _a.loading, hasBothIcons = _a.hasBothIcons, position = _a.position;
    var theme = useContext(ThemeContext);
    var cx = useEmotion().cx;
    var styles = useStyles(getStyles);
    return (React.createElement("span", { className: cx(styles.icon(), position === 'left' && styles.iconLeft(theme), position === 'right' && styles.iconRight(theme)) }, loading && !hasBothIcons ? React.createElement(Spinner, { caption: null, dimmed: true, inline: true }) : icon));
};
//# sourceMappingURL=LinkIcon.js.map