@atlaskit/comment
Version:
A comment displays discussions and user feedback.
59 lines (58 loc) • 1.74 kB
JavaScript
/* 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';
const textStyles = {
root: "_syazazsu"
};
const anchorStyles = {
root: "_4bfu1r31 _1hmsglyw _ajmmnqa1 _9oik1r31 _1bnx8stv _jf4cnqa1 _30l313af _1nrm1r31 _c2waglyw _1iohnqa1 _9h8h12zz"
};
const noAuthorStyles = {
root: "_k48p1kw7"
};
const hasAuthorStyles = {
root: "_k48p1wq8"
};
/**
* __Field__
*
* A field appears in the comment header to add metadata to the comment.
*
* @internal
*/
const Field = ({
children,
hasAuthor,
href,
onClick,
onFocus,
onMouseOver,
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;