@wordpress/block-library
Version:
Block library for the WordPress editor.
142 lines (139 loc) • 5.93 kB
JavaScript
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = PostCommentsPlaceholder;
var _blockEditor = require("@wordpress/block-editor");
var _i18n = require("@wordpress/i18n");
var _data = require("@wordpress/data");
var _coreData = require("@wordpress/core-data");
var _element = require("@wordpress/element");
var _form = _interopRequireDefault(require("../../post-comments-form/form"));
var _jsxRuntime = require("react/jsx-runtime");
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function PostCommentsPlaceholder({
postType,
postId
}) {
let [postTitle] = (0, _coreData.useEntityProp)('postType', postType, 'title', postId);
postTitle = postTitle || (0, _i18n.__)('Post Title');
const {
avatarURL
} = (0, _data.useSelect)(select => select(_blockEditor.store).getSettings().__experimentalDiscussionSettings);
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
className: "wp-block-comments__legacy-placeholder",
inert: "true",
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("h3", {
children: /* translators: %s: Post title. */
(0, _i18n.sprintf)((0, _i18n.__)('One response to %s'), postTitle)
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
className: "navigation",
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
className: "alignleft",
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("a", {
href: "#top",
children: ["\xAB ", (0, _i18n.__)('Older Comments')]
})
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
className: "alignright",
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("a", {
href: "#top",
children: [(0, _i18n.__)('Newer Comments'), " \xBB"]
})
})]
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("ol", {
className: "commentlist",
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("li", {
className: "comment even thread-even depth-1",
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("article", {
className: "comment-body",
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("footer", {
className: "comment-meta",
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
className: "comment-author vcard",
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
alt: (0, _i18n.__)('Commenter Avatar'),
src: avatarURL,
className: "avatar avatar-32 photo",
height: "32",
width: "32",
loading: "lazy"
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("b", {
className: "fn",
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("a", {
href: "#top",
className: "url",
children: (0, _i18n.__)('A WordPress Commenter')
})
}), ' ', /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
className: "says",
children: [(0, _i18n.__)('says'), ":"]
})]
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
className: "comment-metadata",
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("a", {
href: "#top",
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("time", {
dateTime: "2000-01-01T00:00:00+00:00",
children: (0, _i18n.__)('January 1, 2000 at 00:00 am')
})
}), ' ', /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
className: "edit-link",
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("a", {
className: "comment-edit-link",
href: "#top",
children: (0, _i18n.__)('Edit')
})
})]
})]
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
className: "comment-content",
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("p", {
children: [(0, _i18n.__)('Hi, this is a comment.'), /*#__PURE__*/(0, _jsxRuntime.jsx)("br", {}), (0, _i18n.__)('To get started with moderating, editing, and deleting comments, please visit the Comments screen in the dashboard.'), /*#__PURE__*/(0, _jsxRuntime.jsx)("br", {}), (0, _element.createInterpolateElement)((0, _i18n.__)('Commenter avatars come from <a>Gravatar</a>.'), {
a:
/*#__PURE__*/
// eslint-disable-next-line jsx-a11y/anchor-has-content
(0, _jsxRuntime.jsx)("a", {
href: "https://gravatar.com/"
})
})]
})
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
className: "reply",
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("a", {
className: "comment-reply-link",
href: "#top",
"aria-label": (0, _i18n.__)('Reply to A WordPress Commenter'),
children: (0, _i18n.__)('Reply')
})
})]
})
})
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
className: "navigation",
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
className: "alignleft",
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("a", {
href: "#top",
children: ["\xAB ", (0, _i18n.__)('Older Comments')]
})
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
className: "alignright",
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("a", {
href: "#top",
children: [(0, _i18n.__)('Newer Comments'), " \xBB"]
})
})]
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_form.default, {
postId: postId,
postType: postType
})]
});
}
//# sourceMappingURL=placeholder.js.map
;