@atlaskit/comment
Version:
A comment displays discussions and user feedback.
65 lines (63 loc) • 2.16 kB
JavaScript
/* field.tsx generated by @compiled/babel-plugin v3.0.2 */
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
require("./field.compiled.css");
var _runtime = require("@compiled/react/runtime");
var _react = _interopRequireDefault(require("react"));
var _css = require("@atlaskit/css");
var _compiled = require("@atlaskit/primitives/compiled");
var textStyles = {
root: "_syazazsu"
};
var anchorStyles = {
root: "_4bfu1r31 _1hmsglyw _ajmmnqa1 _9oik1r31 _1bnx8stv _jf4cnqa1 _30l313af _1nrm1r31 _c2waglyw _1iohnqa1 _9h8h12zz"
};
var noAuthorStyles = {
root: "_k48p1kw7"
};
var hasAuthorStyles = {
root: "_k48p1wq8"
};
/**
* __Field__
*
* A field appears in the comment header to add metadata to the comment.
*
* @internal
*/
var Field = function Field(_ref) {
var children = _ref.children,
hasAuthor = _ref.hasAuthor,
href = _ref.href,
onClick = _ref.onClick,
onFocus = _ref.onFocus,
onMouseOver = _ref.onMouseOver,
testId = _ref.testId;
return href ? /*#__PURE__*/_react.default.createElement(_compiled.Anchor, {
href: href,
xcss: (0, _css.cx)(textStyles.root, anchorStyles.root, hasAuthor ? hasAuthorStyles.root : noAuthorStyles.root),
onClick: onClick,
onFocus: onFocus,
onMouseOver: onMouseOver,
testId: testId
}, children) : /*#__PURE__*/_react.default.createElement("span", {
/**
* It is not normally acceptable to add key handlers to non-interactive elements
* as this is an accessibility anti-pattern. However, because this instance is
* to add support for analytics instead of creating an inaccessible
* custom element, we can add role="presentation" so that there are no negative
* impacts to assistive technologies.
*/
role: "presentation",
onClick: onClick,
onFocus: onFocus,
onMouseOver: onMouseOver,
"data-testid": testId,
className: (0, _runtime.ax)([textStyles.root, hasAuthor ? hasAuthorStyles.root : noAuthorStyles.root])
}, children);
};
var _default = exports.default = Field;