@wordpress/block-library
Version:
Block library for the WordPress editor.
32 lines (31 loc) • 1.06 kB
JavaScript
import { jsx } from "react/jsx-runtime";
import clsx from "clsx";
import {
getColorClassName,
useBlockProps,
__experimentalGetColorClassesAndStyles as getColorClassesAndStyles
} from "@wordpress/block-editor";
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