Skip to content

Commit 52d13de

Browse files
author
Alexandre Stanislawski
committed
feat(connector): connectRefinementList jsdoc + start document bool isFirstRendering
1 parent 2e30d7e commit 52d13de

File tree

6 files changed

+29
-24
lines changed

6 files changed

+29
-24
lines changed

src/connectors/refinement-list/connectRefinementList.js

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -34,25 +34,30 @@ export const checkUsage = ({attributeName, operator, usageMessage}) => {
3434
};
3535

3636
/**
37-
* refinementList connector, allows you to create your own refinement list and completely tune
38-
* the rendering of it.
39-
* @name connectRefinementList
40-
* @TODO: I do not know how to document the dual ()() call in an efficient way with jsDoc that will also be easy
41-
* to crawl with the doc crawler (maybe re-use exposed props and provided props but rename it for non react people?)
42-
* @param {function} renderFn The rendering function.
43-
* @providedProp isFirstRender
44-
* @providedProp isFromSearch
45-
* @providedProp createURL
46-
* @providedProp items
47-
* @providedProp refine
48-
* @providedProp searchForItems
49-
* @providedProp instantSearchInstance
50-
* @providedProp canRefine
51-
* @exposedProp attributeName
52-
* @exposedProp operator
53-
* @exposedProp limit
54-
* @exposedProp sortBy
55-
* @return {[type]} [description]
37+
* @typedef {Object} RefinementListRenderingOptions
38+
* @property {string} attributeName the attribute in the records that are used by the widget
39+
* @property {string} operator how the filters are combined together
40+
* @property {number} limit the max number of items displayed
41+
* @property {string[]} sortBy how the values are ordered
42+
*/
43+
44+
/**
45+
* @typedef {Object} RefinementListRenderingOptions
46+
* @property {Object[]} items the list of filtering values returned from Algolia
47+
* @property {function} createURL create the next state url
48+
* @property {function} refine set the next state url
49+
* @property {function} searchForItems search for values inside the list
50+
* @property {boolean} isFromSearch indicates if the values are from an index search
51+
* @property {boolean} canRefine indicates if a refinement can be applied
52+
* @property {InstantSearch} instantSearchInstance the instance of instantsearch on which the widget is attached
53+
*/
54+
55+
/**
56+
* Creates a custom widget for a refinement list.
57+
*
58+
* @function connectRefinementList
59+
* @param {function(RefinementListRenderingOptions, boolean)} renderFn function that renders the refinement list widget
60+
* @returns {function(RefinementListWidgetOptions)} a custom refinement list widget factory
5661
*/
5762
export default function connectRefinementList(renderFn) {
5863
checkRendering(renderFn, usage);

src/connectors/search-box/connectSearchBox.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Full documentation available at https://community.algolia.com/instantsearch.js/c
3434

3535
/**
3636
* Connects a rendering function with the search box business logic.
37-
* @param {function(SearchBoxRenderingOptions)} renderFn function that renders the search box widget
37+
* @param {function(SearchBoxRenderingOptions, boolean)} renderFn function that renders the search box widget
3838
* @return {function(CustomSearchBoxWidgetOptions)} a widget factory for search box widget
3939
*/
4040
export default function connectSearchBox(renderFn) {

src/connectors/sort-by-selector/connectSortBySelector.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Full documentation available at https://community.algolia.com/instantsearch.js/c
3434

3535
/**
3636
* Connects a rendering function with the sort by selector business logic.
37-
* @param {function(SortBySelectorRenderingOptions)} renderFn function that renders the sort by selector widget
37+
* @param {function(SortBySelectorRenderingOptions, boolean)} renderFn function that renders the sort by selector widget
3838
* @return {function(CustomSortBySelectorWidgetOptions)} a widget factory for sort by selector widget
3939
*/
4040
export default function connectSortBySelector(renderFn) {

src/connectors/star-rating/connectStarRating.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Full documentation available at https://community.algolia.com/instantsearch.js/c
3636

3737
/**
3838
* Connects a rendering function with the star rating business logic.
39-
* @param {function(StarRatingRenderingOptions)} renderFn function that renders the star rating widget
39+
* @param {function(StarRatingRenderingOptions, boolean)} renderFn function that renders the star rating widget
4040
* @return {function(CustomStarRatingWidgetOptions)} a widget factory for star rating widget
4141
*/
4242
export default function connectStarRating(renderFn) {

src/connectors/stats/connectStats.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Full documentation available at https://community.algolia.com/instantsearch.js/c
2828

2929
/**
3030
* Connects a rendering function with the stats business logic.
31-
* @param {function(StatsRenderingOptions)} renderFn function that renders the stats widget
31+
* @param {function(StatsRenderingOptions, boolean)} renderFn function that renders the stats widget
3232
* @return {function} a widget factory for stats widget
3333
*/
3434
export default function connectStats(renderFn) {

src/connectors/toggle/connectToggle.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Full documentation available at https://community.algolia.com/instantsearch.js/c
4040

4141
/**
4242
* Connects a rendering function with the toggle business logic.
43-
* @param {function(ToggleRenderingOptions)} renderFn function that renders the toggle widget
43+
* @param {function(ToggleRenderingOptions, boolean)} renderFn function that renders the toggle widget
4444
* @return {function(CustomToggleWidgetOptions)} a widget factory for toggle widget
4545
*/
4646
export default function connectToggle(renderFn) {

0 commit comments

Comments
 (0)