UNPKG

@wordpress/block-library

Version:
27 lines (26 loc) • 1.05 kB
import clsx from "clsx"; import { __experimentalGetColorClassesAndStyles, getColorClassName, useBlockProps } from "@wordpress/block-editor"; import { jsx } from "react/jsx-runtime"; // packages/block-library/src/separator/save.jsx function separatorSave({ attributes }) { const { backgroundColor, style, opacity, tagName: Tag } = attributes; const customColor = style?.color?.background; const colorProps = __experimentalGetColorClassesAndStyles(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.mjs.map