@wordpress/block-library
Version:
Block library for the WordPress editor.
39 lines (38 loc) • 1.15 kB
JavaScript
/**
* WordPress dependencies
*/
import { ToggleControl } from '@wordpress/components';
import { __ } from '@wordpress/i18n';
/**
* Internal dependencies
*/
import { useUnsupportedBlocks } from '../../utils';
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
export default function EnhancedPaginationControl({
enhancedPagination,
setAttributes,
clientId
}) {
const {
hasUnsupportedBlocks
} = useUnsupportedBlocks(clientId);
let help = __('Reload the full page—instead of just the posts list—when visitors navigate between pages.');
if (hasUnsupportedBlocks) {
help = __('Enhancement disabled because there are non-compatible blocks inside the Query block.');
}
return /*#__PURE__*/_jsx(_Fragment, {
children: /*#__PURE__*/_jsx(ToggleControl, {
__nextHasNoMarginBottom: true,
label: __('Reload full page'),
help: help,
checked: !enhancedPagination,
disabled: hasUnsupportedBlocks,
onChange: value => {
setAttributes({
enhancedPagination: !value
});
}
})
});
}
//# sourceMappingURL=enhanced-pagination-control.js.map