@sanity/desk-tool
Version:
Tool for managing all sorts of content in a structured manner
29 lines (28 loc) • 983 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.DeprecatedErrorDialog = DeprecatedErrorDialog;
var _ui = require("@sanity/ui");
var _react = require("react");
function DeprecatedErrorDialog(props) {
var dialog = props.dialog;
var content = dialog.content,
onClose = dialog.onClose,
title = dialog.title;
var _useToast = (0, _ui.useToast)(),
pushToast = _useToast.push;
(0, _react.useEffect)(() => {
pushToast({
closable: true,
status: 'error',
title,
description: content
});
setTimeout(onClose, 0);
}, [content, onClose, pushToast, title]);
(0, _react.useEffect)(() => {
console.warn(['The "error" document action dialog is deprecated.', 'Use `useToast()` from @sanity/ui instead:', '```', 'import {useToast} from "@sanity/ui"', 'function MyDocumentAction () {\n const toast = useToast()\n useEffect(() => toast.push(...))\n}', '```'].join('\n\n'));
}, []);
return null;
}