UNPKG

@wordpress/block-library

Version:
45 lines (41 loc) 1.7 kB
import { createElement } from "@wordpress/element"; /** * External dependencies */ import classnames from 'classnames'; /** * WordPress dependencies */ import { getColorClassName, useBlockProps, __experimentalGetColorClassesAndStyles as getColorClassesAndStyles } from '@wordpress/block-editor'; export default function separatorSave(_ref) { var _style$color, _colorProps$style; let { attributes } = _ref; const { backgroundColor, style, opacity } = attributes; const customColor = style === null || style === void 0 ? void 0 : (_style$color = style.color) === null || _style$color === void 0 ? void 0 : _style$color.background; const colorProps = getColorClassesAndStyles(attributes); // The hr support changing color using border-color, since border-color // is not yet supported in the color palette, we use background-color. // The dots styles uses text for the dots, to change those dots color is // using color, not backgroundColor. const colorClass = getColorClassName('color', backgroundColor); const className = classnames({ '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 === null || colorProps === void 0 ? void 0 : (_colorProps$style = colorProps.style) === null || _colorProps$style === void 0 ? void 0 : _colorProps$style.backgroundColor, color: colorClass ? undefined : customColor }; return createElement("hr", useBlockProps.save({ className, style: styles })); } //# sourceMappingURL=save.js.map