UNPKG

@wordpress/block-library

Version:
139 lines (138 loc) • 4.7 kB
import { store } from "@wordpress/block-editor"; import { __, _x, sprintf } from "@wordpress/i18n"; import { useSelect } from "@wordpress/data"; import { useEntityProp } from "@wordpress/core-data"; import { createInterpolateElement } from "@wordpress/element"; import { inertValue } from "@wordpress/react-inert-value"; import CommentsForm from "../../post-comments-form/form.mjs"; import { jsx, jsxs } from "react/jsx-runtime"; // packages/block-library/src/comments/edit/placeholder.jsx function PostCommentsPlaceholder({ postType, postId }) { let [postTitle] = useEntityProp("postType", postType, "title", postId); postTitle = postTitle || __("Post Title"); const avatarURL = useSelect((select) => select(store).getSettings().__experimentalDiscussionSettings?.avatarURL, []); return /* @__PURE__ */ jsxs("div", { className: "wp-block-comments__legacy-placeholder", inert: inertValue(true), children: [ /* @__PURE__ */ jsx("h3", { children: sprintf(__("One response to %s"), postTitle) }), /* @__PURE__ */ jsxs("div", { className: "navigation", children: [/* @__PURE__ */ jsx("div", { className: "alignleft", children: /* @__PURE__ */ jsxs("a", { href: "#top", children: ["« ", __("Older Comments")] }) }), /* @__PURE__ */ jsx("div", { className: "alignright", children: /* @__PURE__ */ jsxs("a", { href: "#top", children: [__("Newer Comments"), " »"] }) })] }), /* @__PURE__ */ jsx("ol", { className: "commentlist", children: /* @__PURE__ */ jsx("li", { className: "comment even thread-even depth-1", children: /* @__PURE__ */ jsxs("article", { className: "comment-body", children: [ /* @__PURE__ */ jsxs("footer", { className: "comment-meta", children: [/* @__PURE__ */ jsxs("div", { className: "comment-author vcard", children: [ /* @__PURE__ */ jsx("img", { alt: __("Commenter Avatar"), src: avatarURL, className: "avatar avatar-32 photo", height: "32", width: "32", loading: "lazy" }), /* @__PURE__ */ jsx("b", { className: "fn", children: /* @__PURE__ */ jsx("a", { href: "#top", className: "url", children: __("A WordPress Commenter") }) }), " ", /* @__PURE__ */ jsxs("span", { className: "says", children: [__("says"), ":"] }) ] }), /* @__PURE__ */ jsxs("div", { className: "comment-metadata", children: [ /* @__PURE__ */ jsx("a", { href: "#top", children: /* @__PURE__ */ jsx("time", { dateTime: "2000-01-01T00:00:00+00:00", children: __("January 1, 2000 at 00:00 am") }) }), " ", /* @__PURE__ */ jsx("span", { className: "edit-link", children: /* @__PURE__ */ jsx("a", { className: "comment-edit-link", href: "#top", children: __("Edit") }) }) ] })] }), /* @__PURE__ */ jsx("div", { className: "comment-content", children: /* @__PURE__ */ jsxs("p", { children: [ __("Hi, this is a comment."), /* @__PURE__ */ jsx("br", {}), __("To get started with moderating, editing, and deleting comments, please visit the Comments screen in the dashboard."), /* @__PURE__ */ jsx("br", {}), createInterpolateElement(__("Commenter avatars come from <a>Gravatar</a>."), { a: /* @__PURE__ */ jsx("a", { href: "https://gravatar.com/" }) }) ] }) }), /* @__PURE__ */ jsx("div", { className: "reply", children: /* @__PURE__ */ jsx("a", { className: "comment-reply-link", href: "#top", "aria-label": __("Reply to A WordPress Commenter"), children: _x("Reply", "verb") }) }) ] }) }) }), /* @__PURE__ */ jsxs("div", { className: "navigation", children: [/* @__PURE__ */ jsx("div", { className: "alignleft", children: /* @__PURE__ */ jsxs("a", { href: "#top", children: ["« ", __("Older Comments")] }) }), /* @__PURE__ */ jsx("div", { className: "alignright", children: /* @__PURE__ */ jsxs("a", { href: "#top", children: [__("Newer Comments"), " »"] }) })] }), /* @__PURE__ */ jsx(CommentsForm, { postId, postType }) ] }); } export { PostCommentsPlaceholder as default }; //# sourceMappingURL=placeholder.mjs.map