"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
var _typeof = require("@babel/runtime/helpers/typeof");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.CommentBadgeNext = void 0;
var _react = _interopRequireWildcard(require("react"));
var _reactIntlNext = require("react-intl-next");
var _comment = _interopRequireDefault(require("@atlaskit/icon/core/comment"));
var _primitives = require("@atlaskit/primitives");
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
var _media = require("../media");
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
// eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss

var baseStyles = (0, _primitives.xcss)({
  borderRadius: 'radius.small'
});
var mediumBadgeStyles = (0, _primitives.xcss)({
  height: 'space.300',
  width: 'space.300'
});
var CommentBadgeNext = exports.CommentBadgeNext = function CommentBadgeNext(_ref) {
  var _ref$status = _ref.status,
    status = _ref$status === void 0 ? 'default' : _ref$status,
    onClick = _ref.onClick,
    onMouseEnter = _ref.onMouseEnter,
    onMouseLeave = _ref.onMouseLeave;
  var intl = (0, _reactIntlNext.useIntl)();
  var title = intl.formatMessage(_media.commentMessages.viewCommentsOnMedia);
  var colourToken = (0, _react.useMemo)(function () {
    switch (status) {
      case 'active':
        return 'color.background.accent.yellow.subtlest.pressed';
      case 'entered':
        return 'color.background.accent.yellow.subtlest.hovered';
      default:
        return 'color.background.accent.yellow.subtlest';
    }
  }, [status]);
  return /*#__PURE__*/_react.default.createElement(_tooltip.default, {
    position: "top",
    content: title
  }, /*#__PURE__*/_react.default.createElement(_primitives.Pressable, {
    xcss: [baseStyles, mediumBadgeStyles],
    padding: "space.0",
    onClick: onClick,
    onMouseEnter: onMouseEnter,
    onMouseLeave: onMouseLeave,
    backgroundColor: colourToken
  }, /*#__PURE__*/_react.default.createElement(_comment.default, {
    label: title,
    spacing: "spacious",
    color: "currentColor"
  })));
};