@wordpress/editor
Version:
Enhanced block editor for WordPress posts.
45 lines • 1.14 kB
JavaScript
/**
* External dependencies
*/
import clsx from 'clsx';
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
const TableOfContentsItem = ({
children,
isValid,
isDisabled,
level,
href,
onSelect
}) => {
function handleClick(event) {
if (isDisabled) {
event.preventDefault();
return;
}
onSelect();
}
return /*#__PURE__*/_jsx("li", {
className: clsx('document-outline__item', `is-${level.toLowerCase()}`, {
'is-invalid': !isValid,
'is-disabled': isDisabled
}),
children: /*#__PURE__*/_jsxs("a", {
href: href,
className: "document-outline__button",
"aria-disabled": isDisabled,
onClick: handleClick,
children: [/*#__PURE__*/_jsx("span", {
className: "document-outline__emdash",
"aria-hidden": "true"
}), /*#__PURE__*/_jsx("strong", {
className: "document-outline__level",
children: level
}), /*#__PURE__*/_jsx("span", {
className: "document-outline__item-content",
children: children
})]
})
});
};
export default TableOfContentsItem;
//# sourceMappingURL=item.js.map