@primer/react
Version:
An implementation of GitHub's Primer Design System using React
51 lines (48 loc) • 1.14 kB
JavaScript
import React from 'react';
import { Item } from './Item.js';
import { jsx } from 'react/jsx-runtime';
import Link from '../Link/Link.js';
const LinkItem = /*#__PURE__*/React.forwardRef(({
sx,
active,
inactiveText,
variant,
size,
as: Component,
className,
...props
}, forwardedRef) => {
return /*#__PURE__*/jsx(Item, {
className: className,
active: active,
inactiveText: inactiveText,
"data-inactive": inactiveText ? true : undefined,
variant: variant,
size: size,
sx: sx,
_PrivateItemWrapper: ({
children,
onClick,
...rest
}) => {
const clickHandler = event => {
onClick && onClick(event);
props.onClick && props.onClick(event);
};
return inactiveText ? /*#__PURE__*/jsx("span", {
...rest,
children: children
}) : /*#__PURE__*/jsx(Link, {
as: Component,
...rest,
...props,
onClick: clickHandler,
ref: forwardedRef,
children: children
});
},
children: props.children
});
});
LinkItem.displayName = 'ActionList.LinkItem';
export { LinkItem };