UNPKG

@wordpress/block-library

Version:
28 lines (27 loc) • 1.16 kB
import { Warning } from "@wordpress/block-editor"; import { Button, Notice } from "@wordpress/components"; import { __ } from "@wordpress/i18n"; import { createInterpolateElement, useState } from "@wordpress/element"; import { jsx } from "react/jsx-runtime"; // packages/block-library/src/navigation/edit/deleted-navigation-warning.jsx 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 { DeletedNavigationWarning as default }; //# sourceMappingURL=deleted-navigation-warning.mjs.map