@wordpress/block-library
Version:
Block library for the WordPress editor.
57 lines (56 loc) • 1.73 kB
JavaScript
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
import clsx from "clsx";
import {
AlignmentControl,
BlockControls,
Warning,
useBlockProps
} from "@wordpress/block-editor";
import { __ } from "@wordpress/i18n";
import { Button } from "@wordpress/components";
import Placeholder from "./placeholder";
function CommentsLegacy({
attributes,
setAttributes,
context: { postType, postId }
}) {
const { textAlign } = attributes;
const actions = [
/* @__PURE__ */ jsx(
Button,
{
__next40pxDefaultSize: true,
onClick: () => void setAttributes({ legacy: false }),
variant: "primary",
children: __("Switch to editable mode")
},
"convert"
)
];
const blockProps = useBlockProps({
className: clsx({
[`has-text-align-${textAlign}`]: textAlign
})
});
return /* @__PURE__ */ jsxs(Fragment, { children: [
/* @__PURE__ */ jsx(BlockControls, { group: "block", children: /* @__PURE__ */ jsx(
AlignmentControl,
{
value: textAlign,
onChange: (nextAlign) => {
setAttributes({ textAlign: nextAlign });
}
}
) }),
/* @__PURE__ */ jsxs("div", { ...blockProps, children: [
/* @__PURE__ */ jsx(Warning, { actions, children: __(
"Comments block: You\u2019re currently using the legacy version of the block. The following is just a placeholder - the final styling will likely look different. For a better representation and more customization options, switch the block to its editable mode."
) }),
/* @__PURE__ */ jsx(Placeholder, { postId, postType })
] })
] });
}
export {
CommentsLegacy as default
};
//# sourceMappingURL=comments-legacy.js.map