import _extends from "@babel/runtime/helpers/extends";
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
var _excluded = ["actionGroup", "icon", "position", "testId", "title", "hideIcon"];
/* eslint-disable @atlaskit/ui-styling-standard/no-unsafe-values */
import React from 'react';
import { SmartLinkSize } from '../../../../../../constants';
import { LoadingSkeleton } from '../../../common/loading-skeleton';
import { LinkIcon } from '../../../elements';
import { getIconWidth } from '../../../utils';
import Block from '../../block';
/**
 * This represents a TitleBlock for a Smart Link that is currently waiting
 * for a request to finish.
 * This should render when a Smart Link has sent a request.
 * @see TitleBlock
 */
var TitleBlockResolvingView = function TitleBlockResolvingView(_ref) {
  var actionGroup = _ref.actionGroup,
    icon = _ref.icon,
    position = _ref.position,
    testId = _ref.testId,
    title = _ref.title,
    hideIcon = _ref.hideIcon,
    blockProps = _objectWithoutProperties(_ref, _excluded);
  var _blockProps$size = blockProps.size,
    size = _blockProps$size === void 0 ? SmartLinkSize.Medium : _blockProps$size;
  var iconWidth = getIconWidth(size);
  return /*#__PURE__*/React.createElement(Block, _extends({}, blockProps, {
    testId: "".concat(testId, "-resolving-view")
  }), !hideIcon && icon && /*#__PURE__*/React.createElement(LinkIcon, {
    overrideIcon: icon,
    position: position,
    size: size,
    hideLoadingSkeleton: true
  }), !hideIcon && !icon && /*#__PURE__*/React.createElement("span", {
    style: {
      width: iconWidth,
      height: iconWidth
    },
    "data-testid": "".concat(testId, "-icon")
  }, /*#__PURE__*/React.createElement(LoadingSkeleton, {
    width: iconWidth,
    height: iconWidth,
    testId: "".concat(testId, "-icon-loading")
  })), title, actionGroup);
};
export default TitleBlockResolvingView;