@quillforms/block-editor
Version:
60 lines (57 loc) • 1.54 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _data = require("@wordpress/data");
var _components = require("@wordpress/components");
var _icons = require("@wordpress/icons");
var _jsxRuntime = require("react/jsx-runtime");
/**
* WordPress Dependencies
*/
/**
* External Dependencies
*/
const BlockAttachment = ({
blockColor,
attachment,
id,
parentId
}) => {
const {
setBlockAttributes
} = (0, _data.useDispatch)('quillForms/block-editor');
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
className: "block-editor-block-attachment",
style: {
borderColor: blockColor
},
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
alt: "",
className: "block-editor-block-attachment__image",
src: attachment.url
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
role: "presentation",
className: "block-editor-block-attachment__delete",
onClick: () => {
setBlockAttributes(id, {
attachment: {}
}, parentId);
},
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
className: "block-editor-block-attachment__background-wrapper",
style: {
backgroundColor: blockColor
}
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Icon, {
icon: _icons.close,
style: {
color: blockColor
}
})]
})]
});
};
var _default = exports.default = BlockAttachment;
//# sourceMappingURL=index.js.map