UNPKG

@wordpress/block-library

Version:
27 lines (26 loc) • 1.02 kB
"use strict"; Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } }); let _wordpress_block_editor = require("@wordpress/block-editor"); let ___utils_hooks_js = require("../utils/hooks.cjs"); let react_jsx_runtime = require("react/jsx-runtime"); // packages/block-library/src/post-comments-count/edit.jsx function PostCommentsCountEdit({ context }) { const { postId } = context; const { totalItems: commentsCount } = (0, ___utils_hooks_js.usePostCommentsCount)(postId); const blockProps = (0, _wordpress_block_editor.useBlockProps)(); const hasPostAndComments = postId && commentsCount !== null; const blockStyles = { ...blockProps.style, textDecoration: hasPostAndComments ? blockProps.style?.textDecoration : void 0 }; return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { ...blockProps, style: blockStyles, children: hasPostAndComments ? commentsCount : "0" }); } exports.default = PostCommentsCountEdit; //# sourceMappingURL=edit.cjs.map