@guestbell/react-page-plugins
Version:
Plugins we use in GuestBell for working with amazing react-page package
30 lines • 924 B
JavaScript
import Switch from '@mui/material/Switch';
import FormControlLabel from '@mui/material/FormControlLabel';
import React from 'react';
import { useCellProps, useSetDraft } from '@react-page/editor';
export var DraftSwitch = function DraftSwitch(_ref) {
var nodeId = _ref.nodeId,
lang = _ref.lang;
var cell = useCellProps(nodeId, function (c) {
return {
isDraft: c.isDraft
};
});
var setDraft = useSetDraft(nodeId);
return cell ? /*#__PURE__*/React.createElement(FormControlLabel, {
className: "bottomToolbar__draftSwitch",
style: {
marginRight: 0
},
labelPlacement: "start",
control: /*#__PURE__*/React.createElement(Switch, {
color: "primary",
checked: Boolean(cell.isDraft),
onChange: function onChange(e) {
return setDraft(e.target.checked, undefined);
}
}),
label: "Draft"
}) : null;
};
//# sourceMappingURL=DraftSwitch.js.map