UNPKG

@atlaskit/comment

Version:

A comment displays discussions and user feedback.

58 lines (57 loc) • 1.87 kB
/* field.tsx generated by @compiled/babel-plugin v3.0.2 */ import "./field.compiled.css"; import { ax, ix } from "@compiled/react/runtime"; import React from 'react'; import { cx } from '@atlaskit/css'; import { Anchor } from '@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.createElement(Anchor, { href: href, xcss: cx(textStyles.root, anchorStyles.root, hasAuthor ? hasAuthorStyles.root : noAuthorStyles.root), onClick: onClick, onFocus: onFocus, onMouseOver: onMouseOver, testId: testId }, children) : /*#__PURE__*/React.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: ax([textStyles.root, hasAuthor ? hasAuthorStyles.root : noAuthorStyles.root]) }, children); }; export default Field;