@wordpress/block-library
Version:
Block library for the WordPress editor.
33 lines (32 loc) • 1.11 kB
JavaScript
// packages/block-library/src/separator/save.js
import clsx from "clsx";
import {
getColorClassName,
useBlockProps,
__experimentalGetColorClassesAndStyles as getColorClassesAndStyles
} from "@wordpress/block-editor";
import { jsx } from "react/jsx-runtime";
function separatorSave({ attributes }) {
const { backgroundColor, style, opacity, tagName: Tag } = attributes;
const customColor = style?.color?.background;
const colorProps = getColorClassesAndStyles(attributes);
const colorClass = getColorClassName("color", backgroundColor);
const className = clsx(
{
"has-text-color": backgroundColor || customColor,
[colorClass]: colorClass,
"has-css-opacity": opacity === "css",
"has-alpha-channel-opacity": opacity === "alpha-channel"
},
colorProps.className
);
const styles = {
backgroundColor: colorProps?.style?.backgroundColor,
color: colorClass ? void 0 : customColor
};
return /* @__PURE__ */ jsx(Tag, { ...useBlockProps.save({ className, style: styles }) });
}
export {
separatorSave as default
};
//# sourceMappingURL=save.js.map