@atlaskit/tag
Version:
A tag labels UI objects for quick recognition and navigation.
28 lines (26 loc) • 1.02 kB
JavaScript
import React, { Fragment } from 'react';
// Props for the link wrapper
// Shared component for conditional link wrapping
export function LinkWrapper({
isLink,
href,
LinkComponent,
testId,
children,
onClick,
linkHandlers
}) {
if (isLink && href) {
return /*#__PURE__*/React.createElement(LinkComponent, {
href: href,
testId: testId ? `${testId}--link` : undefined,
onClick: onClick,
onMouseEnter: linkHandlers === null || linkHandlers === void 0 ? void 0 : linkHandlers.onMouseEnter,
onMouseLeave: linkHandlers === null || linkHandlers === void 0 ? void 0 : linkHandlers.onMouseLeave,
onMouseDown: linkHandlers === null || linkHandlers === void 0 ? void 0 : linkHandlers.onMouseDown,
onFocus: linkHandlers === null || linkHandlers === void 0 ? void 0 : linkHandlers.onFocus,
onBlur: linkHandlers === null || linkHandlers === void 0 ? void 0 : linkHandlers.onBlur
}, children);
}
return /*#__PURE__*/React.createElement(Fragment, null, children);
}