diff --git a/src/connectors/hits-per-page-selector/connectHitsPerPageSelector.js b/src/connectors/hits-per-page-selector/connectHitsPerPageSelector.js index fa66670223..1a4c7eb63f 100644 --- a/src/connectors/hits-per-page-selector/connectHitsPerPageSelector.js +++ b/src/connectors/hits-per-page-selector/connectHitsPerPageSelector.js @@ -1,87 +1,117 @@ import some from 'lodash/some'; +import {checkRendering} from '../../lib/utils.js'; + +const usage = `Usage: +var customHitsPerPage = connectHitsPerPageSelector(function render(params, isFirstRendering) { + // params = { + // options, + // currentValue, + // setValue, + // hasNoResults, + // instantSearchInstance, + // widgetParams, + // } +}); +search.addWidget( + options: [ + {value: 10, label: '10 results per page'}, + {value: 42, label: '42 results per page'}, + ], +); +Full documentation available at https://community.algolia.com/instantsearch.js/connectors/connectHitsPerPageSelector.html +`; + /** - * Instantiate a dropdown element to choose the number of hits to display per page - * @function connectHitsPerPageSelector - * @param {string|DOMElement} options.container CSS Selector or DOMElement to insert the widget - * @param {Array} options.options Array of objects defining the different values and labels - * @param {number} options.options[0].value number of hits to display per page - * @param {string} options.options[0].label Label to display in the option - * @param {boolean} [options.autoHideContainer=false] Hide the container when no results match - * @param {Object} [options.cssClasses] CSS classes to be added - * @param {string|string[]} [options.cssClasses.root] CSS classes added to the parent `