@atlaskit/comment
Version:
A comment displays discussions and user feedback.
44 lines (43 loc) • 1.54 kB
JavaScript
import React, { forwardRef } from 'react';
import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next/usePlatformLeafEventHandler';
import Button from '@atlaskit/button/button';
const ActionItem = /*#__PURE__*/forwardRef(({
children,
onClick: providedOnClick,
onFocus,
onMouseOver,
isDisabled
}, ref) => {
const onClick = usePlatformLeafEventHandler({
fn: (event, analyticsEvent) => providedOnClick && providedOnClick(event, analyticsEvent),
action: 'clicked',
componentName: 'commentAction',
packageName: "@atlaskit/comment",
packageVersion: "14.2.5"
});
return (
/*#__PURE__*/
/**
* It is not normally acceptable to add click and 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.
*/
// eslint-disable-next-line @atlassian/a11y/interactive-element-not-keyboard-focusable
React.createElement("span", {
role: "presentation",
onClick: onClick,
onFocus: onFocus,
onMouseOver: onMouseOver
}, /*#__PURE__*/React.createElement(Button, {
ref: ref,
appearance: "subtle-link",
spacing: "none",
type: "button",
isDisabled: isDisabled
}, children))
);
});
// eslint-disable-next-line @repo/internal/react/require-jsdoc
export default ActionItem;