import "choerodon-ui/lib/tooltip/style";
import _Tooltip from "choerodon-ui/lib/tooltip";
import "choerodon-ui/lib/icon/style";
import _Icon from "choerodon-ui/lib/icon";
import React, { Fragment } from 'react';
import { injectIntl, FormattedMessage } from 'react-intl';
import "./Tips.less";

function Tips(_ref) {
  var type = _ref.type,
      data = _ref.data,
      help = _ref.help;
  return /*#__PURE__*/React.createElement(Fragment, null, type === 'title' && /*#__PURE__*/React.createElement("div", {
    className: "c7n-table-title-tip"
  }, /*#__PURE__*/React.createElement(FormattedMessage, {
    id: data
  }), help && /*#__PURE__*/React.createElement(_Tooltip, {
    title: /*#__PURE__*/React.createElement(FormattedMessage, {
      id: "".concat(data, ".tip")
    }),
    overlayClassName: "c7n-tips-popover",
    placement: "topRight",
    arrowPointAtCenter: true
  }, /*#__PURE__*/React.createElement(_Icon, {
    type: "help"
  }))), type === 'form' && /*#__PURE__*/React.createElement(_Tooltip, {
    title: /*#__PURE__*/React.createElement(FormattedMessage, {
      id: data
    }),
    overlayClassName: "c7n-tips-popover",
    placement: "topRight",
    arrowPointAtCenter: true
  }, /*#__PURE__*/React.createElement(_Icon, {
    type: "help c7n-select-tip"
  })));
}

Tips.defaultProps = {
  help: true
};
export default injectIntl(Tips);