UNPKG

@wordpress/editor

Version:
37 lines (34 loc) 1.06 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = EditorSnackbars; var _components = require("@wordpress/components"); var _data = require("@wordpress/data"); var _notices = require("@wordpress/notices"); var _jsxRuntime = require("react/jsx-runtime"); /** * WordPress dependencies */ // Last three notices. Slices from the tail end of the list. const MAX_VISIBLE_NOTICES = -3; /** * Renders the editor snackbars component. * * @return {JSX.Element} The rendered component. */ function EditorSnackbars() { const notices = (0, _data.useSelect)(select => select(_notices.store).getNotices(), []); const { removeNotice } = (0, _data.useDispatch)(_notices.store); const snackbarNotices = notices.filter(({ type }) => type === 'snackbar').slice(MAX_VISIBLE_NOTICES); return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.SnackbarList, { notices: snackbarNotices, className: "components-editor-notices__snackbar", onRemove: removeNotice }); } //# sourceMappingURL=index.js.map