@gechiui/block-editor
Version:
47 lines (40 loc) • 1.16 kB
JavaScript
import { createElement } from "@gechiui/element";
/**
* Internal dependencies
*/
import BorderRadiusControl from '../components/border-radius-control';
import { cleanEmptyObject } from './utils';
/**
* Inspector control panel containing the border radius related configuration.
*
* @param {Object} props Block properties.
*
* @return {GCElement} Border radius edit element.
*/
export function BorderRadiusEdit(props) {
var _style$border;
const {
attributes: {
style
},
setAttributes
} = props;
const onChange = newRadius => {
let newStyle = { ...style,
border: { ...(style === null || style === void 0 ? void 0 : style.border),
radius: newRadius
}
};
if (newRadius === undefined || newRadius === '') {
newStyle = cleanEmptyObject(newStyle);
}
setAttributes({
style: newStyle
});
};
return createElement(BorderRadiusControl, {
values: style === null || style === void 0 ? void 0 : (_style$border = style.border) === null || _style$border === void 0 ? void 0 : _style$border.radius,
onChange: onChange
});
}
//# sourceMappingURL=border-radius.js.map