UNPKG

@wordpress/block-library

Version:
36 lines 1.17 kB
/** * WordPress dependencies */ import { Warning } from '@wordpress/block-editor'; import { Button, Notice } from '@wordpress/components'; import { __ } from '@wordpress/i18n'; import { useState, createInterpolateElement } from '@wordpress/element'; import { jsx as _jsx } from "react/jsx-runtime"; function DeletedNavigationWarning({ onCreateNew, isNotice = false }) { const [isButtonDisabled, setIsButtonDisabled] = useState(false); const handleButtonClick = () => { setIsButtonDisabled(true); onCreateNew(); }; const message = createInterpolateElement(__('Navigation Menu has been deleted or is unavailable. <button>Create a new Menu?</button>'), { button: /*#__PURE__*/_jsx(Button, { __next40pxDefaultSize: true, onClick: handleButtonClick, variant: "link", disabled: isButtonDisabled, accessibleWhenDisabled: true }) }); return isNotice ? /*#__PURE__*/_jsx(Notice, { status: "warning", isDismissible: false, children: message }) : /*#__PURE__*/_jsx(Warning, { children: message }); } export default DeletedNavigationWarning; //# sourceMappingURL=deleted-navigation-warning.js.map