@quillforms/block-editor
Version:
52 lines • 1.32 kB
JavaScript
/**
* WordPress Dependencies
*/
import { useDispatch } from '@wordpress/data';
/**
* External Dependencies
*/
import { Icon } from '@wordpress/components';
import { close } from '@wordpress/icons';
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
const BlockAttachment = ({
blockColor,
attachment,
id,
parentId
}) => {
const {
setBlockAttributes
} = useDispatch('quillForms/block-editor');
return /*#__PURE__*/_jsxs("div", {
className: "block-editor-block-attachment",
style: {
borderColor: blockColor
},
children: [/*#__PURE__*/_jsx("img", {
alt: "",
className: "block-editor-block-attachment__image",
src: attachment.url
}), /*#__PURE__*/_jsxs("div", {
role: "presentation",
className: "block-editor-block-attachment__delete",
onClick: () => {
setBlockAttributes(id, {
attachment: {}
}, parentId);
},
children: [/*#__PURE__*/_jsx("div", {
className: "block-editor-block-attachment__background-wrapper",
style: {
backgroundColor: blockColor
}
}), /*#__PURE__*/_jsx(Icon, {
icon: close,
style: {
color: blockColor
}
})]
})]
});
};
export default BlockAttachment;
//# sourceMappingURL=index.js.map