@remotion/studio
Version:
APIs for interacting with the Remotion Studio
21 lines (20 loc) • 939 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.TimelineBooleanField = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const react_1 = require("react");
const Checkbox_1 = require("../Checkbox");
const checkboxContainer = {
marginLeft: 8,
};
const TimelineBooleanField = ({ field, codeValue, effectiveValue, canUpdate, onSave }) => {
const checked = Boolean(effectiveValue);
const onChange = (0, react_1.useCallback)(() => {
const newValue = !checked;
if (canUpdate && newValue !== codeValue) {
onSave(field.key, newValue);
}
}, [canUpdate, onSave, field.key, checked, codeValue]);
return (jsx_runtime_1.jsx("div", { style: checkboxContainer, children: jsx_runtime_1.jsx(Checkbox_1.Checkbox, { checked: checked, onChange: onChange, name: field.key, disabled: !canUpdate }) }));
};
exports.TimelineBooleanField = TimelineBooleanField;