import _extends from "@babel/runtime/helpers/extends";
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
var _excluded = ["size"],
  _excluded2 = ["size"];
import React from 'react';
import { IconTile } from '@atlaskit/icon';
import { SmartLinkSize } from '../../../constants';
import { isIconSizeLarge } from '../../../utils';
export var transformSmartLinkSizeToIconTileSize = function transformSmartLinkSizeToIconTileSize(size) {
  switch (size) {
    case SmartLinkSize.XLarge:
    case SmartLinkSize.Large:
      return '24';
    default:
      return '16';
  }
};
export var renderIconPerSize = function renderIconPerSize(IconSmall, IconLarge) {
  return function (_ref) {
    var size = _ref.size,
      props = _objectWithoutProperties(_ref, _excluded);
    if (isIconSizeLarge(size)) {
      return /*#__PURE__*/React.createElement(IconLarge, props);
    }
    return /*#__PURE__*/React.createElement(IconSmall, props);
  };
};
export var renderIconTile = function renderIconTile(Icon, appearance, LegacyIcon) {
  return function (_ref2) {
    var size = _ref2.size,
      props = _objectWithoutProperties(_ref2, _excluded2);
    return /*#__PURE__*/React.createElement(IconTile, _extends({
      appearance: appearance,
      icon: Icon,
      size: transformSmartLinkSizeToIconTileSize(size)
    }, props, {
      LEGACY_fallbackComponent: LegacyIcon && /*#__PURE__*/React.createElement(LegacyIcon, _extends({}, props, {
        size: size
      }))
    }));
  };
};