Skip to content

Commit

Permalink
fix(hideIfEmpty): should be hideWhenNoResults
Browse files Browse the repository at this point in the history
dunno why it was commited this way. reverting
  • Loading branch information
vvo committed Sep 24, 2015
1 parent 3cc48f3 commit 21877a0
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 30 deletions.
10 changes: 5 additions & 5 deletions README.md
Expand Up @@ -265,7 +265,7 @@ search.addWidget(
* @param {String|DOMElement} options.container Valid CSS Selector as a string or DOMElement
* @param {Array} options.indices Array of objects defining the different indices to choose from. Each object must contain a `name` and `label` key.
* @param {String} [options.cssClass] Class name(s) to be added to the generated select element
* @param {boolean} [hideIfEmpty=false] Hide the container when no results match
* @param {boolean} [hideWhenNoResults=false] Hide the container when no results match
* @return {Object}
*/
```
Expand Down Expand Up @@ -362,7 +362,7 @@ search.addWidget(
* @param {String} options.label Human-readable name of the filter (eg. "Free Shipping")
* @param {String|Function} [options.template] Item template, provided with `label` and `isRefined`
* @param {Function} [options.transformData] Function to change the object passed to the item template
* @param {boolean} [hideIfEmpty=true] Hide the container when no results match
* @param {boolean} [hideWhenNoResults=true] Hide the container when no results match
* @return {Object}
*/
```
Expand Down Expand Up @@ -395,7 +395,7 @@ search.addWidget(
* @param {Function} [options.transformData] Function to change the object passed to the item template
* @param {String|Function} [options.singleRefine=true] Are multiple refinements allowed or only one at the same time. You can use this
* to build radio based refinement lists for example
* @param {boolean} [hideIfEmpty=true] Hide the container when no results match
* @param {boolean} [hideWhenNoResults=true] Hide the container when no results match
* @return {Object}
*/
```
Expand Down Expand Up @@ -439,7 +439,7 @@ search.addWidget(
* @param {String|Function} [options.templates.item='<a href="{{href}}">{{name}}</a> {{count}}'] Item template, provided with `name`, `count`, `isRefined`
* @param {String|Function} [options.templates.footer=''] Footer template
* @param {Function} [options.transformData] Function to change the object passed to the item template
* @param {boolean} [hideIfEmpty=true] Hide the container when no results match
* @param {boolean} [hideWhenNoResults=true] Hide the container when no results match
* @return {Object}
*/
```
Expand Down Expand Up @@ -476,7 +476,7 @@ search.addWidget(
* You can also provide
* tooltips: {format: function(formattedValue, rawValue) {return '$' + formattedValue}}
* So that you can format the tooltip display value as you want
* @param {boolean} [hideIfEmpty=true] Hide the container when no results match
* @param {boolean} [hideWhenNoResults=true] Hide the container when no results match
* @return {Object}
*/
```
Expand Down
8 changes: 4 additions & 4 deletions decorators/autoHide.js
Expand Up @@ -12,16 +12,16 @@ function autoHide(ComposedComponent) {

_hideOrShowContainer(props) {
var container = React.findDOMNode(this).parentNode;
if (props.hideIfEmpty === true && props.hasResults === false) {
if (props.hideWhenNoResults === true && props.hasResults === false) {
container.style.display = 'none';
} else if (props.hideIfEmpty === true) {
} else if (props.hideWhenNoResults === true) {
container.style.display = '';
}
}

render() {
if (this.props.hasResults === false &&
this.props.hideIfEmpty === true) {
this.props.hideWhenNoResults === true) {
return <div/>;
}

Expand All @@ -31,7 +31,7 @@ function autoHide(ComposedComponent) {

AutoHide.propTypes = {
hasResults: React.PropTypes.bool.isRequired,
hideIfEmpty: React.PropTypes.bool.isRequired
hideWhenNoResults: React.PropTypes.bool.isRequired
};

// precise displayName for ease of debugging (react dev tool, react warnings)
Expand Down
4 changes: 2 additions & 2 deletions widgets/hits.js
Expand Up @@ -6,7 +6,7 @@ function hits({
container = null,
templates = {},
transformData = {},
hideIfEmpty = false,
hideWhenNoResults = false,
hitsPerPage = 20
}) {
var Hits = require('../components/Hits');
Expand All @@ -23,7 +23,7 @@ function hits({
helper={helper}
noResultsTemplate={templates.empty}
noResultsTransformData={transformData.empty}
hideIfEmpty={hideIfEmpty}
hideWhenNoResults={hideWhenNoResults}
hasResults={results.hits.length > 0}
hitTemplate={templates.hit}
hitTransformData={transformData.hit}
Expand Down
6 changes: 3 additions & 3 deletions widgets/index-selector.js
Expand Up @@ -8,14 +8,14 @@ var utils = require('../lib/utils.js');
* @param {String|DOMElement} options.container Valid CSS Selector as a string or DOMElement
* @param {Array} options.indices Array of objects defining the different indices to choose from. Each object must contain a `name` and `label` key.
* @param {String} [options.cssClass] Class name(s) to be added to the generated select element
* @param {boolean} [hideIfEmpty=false] Hide the container when no results match
* @param {boolean} [hideWhenNoResults=false] Hide the container when no results match
* @return {Object}
*/
function indexSelector({
container = null,
indices = null,
cssClass,
hideIfEmpty = false
hideWhenNoResults = false
}) {
var IndexSelector = require('../components/IndexSelector');
var containerNode = utils.getContainerNode(container);
Expand All @@ -42,7 +42,7 @@ function indexSelector({
cssClass={cssClass}
currentIndex={helper.getIndex()}
indices={indices}
hideIfEmpty={hideIfEmpty}
hideWhenNoResults={hideWhenNoResults}
hasResults={results.hits.length > 0}
setIndex={helper.setIndex.bind(helper)}
/>,
Expand Down
6 changes: 3 additions & 3 deletions widgets/menu.js
Expand Up @@ -28,7 +28,7 @@ var defaults = require('lodash/object/defaults');
* @param {String|Function} [options.templates.item='<a href="{{href}}">{{name}}</a> {{count}}'] Item template, provided with `name`, `count`, `isRefined`
* @param {String|Function} [options.templates.footer=''] Footer template
* @param {Function} [options.transformData] Method to change the object passed to the item template
* @param {boolean} [hideIfEmpty=true] Hide the container when no results match
* @param {boolean} [hideWhenNoResults=true] Hide the container when no results match
* @return {Object}
*/
function menu({
Expand All @@ -41,7 +41,7 @@ function menu({
list: null,
item: null
},
hideIfEmpty = true,
hideWhenNoResults = true,
templates = defaultTemplates,
transformData = null
}) {
Expand Down Expand Up @@ -78,7 +78,7 @@ function menu({
facetValues={facetValues}
templates={templates}
transformData={transformData}
hideIfEmpty={hideIfEmpty}
hideWhenNoResults={hideWhenNoResults}
hasResults={facetValues.length > 0}
toggleRefinement={toggleRefinement.bind(null, helper, hierarchicalFacetName)}
/>,
Expand Down
4 changes: 2 additions & 2 deletions widgets/pagination.js
Expand Up @@ -8,7 +8,7 @@ function pagination({
labels,
maxPages,
showFirstLast,
hideIfEmpty = true
hideWhenNoResults = true
}) {
var Pagination = require('../components/Pagination/Pagination.js');

Expand All @@ -28,7 +28,7 @@ function pagination({
nbPages={nbPages}
setCurrentPage={helper.setCurrentPage.bind(helper)}
cssClass={cssClass}
hideIfEmpty={hideIfEmpty}
hideWhenNoResults={hideWhenNoResults}
hasResults={results.hits.length > 0}
labels={labels}
showFirstLast={showFirstLast}
Expand Down
6 changes: 3 additions & 3 deletions widgets/range-slider.js
Expand Up @@ -11,14 +11,14 @@ var utils = require('../lib/utils.js');
* You can also provide
* tooltips: {format: function(formattedValue, rawValue) {return '$' + formattedValue}}
* So that you can format the tooltip display value as you want
* @param {boolean} [hideIfEmpty=true] Hide the container when no results match
* @param {boolean} [hideWhenNoResults=true] Hide the container when no results match
* @return {Object}
*/
function rangeSlider({
container = null,
facetName = null,
tooltips = true,
hideIfEmpty = true
hideWhenNoResults = true
}) {
var Slider = require('../components/Slider');

Expand Down Expand Up @@ -71,7 +71,7 @@ function rangeSlider({
<Slider
start={[currentRefinement.min, currentRefinement.max]}
range={{min: stats.min, max: stats.max}}
hideIfEmpty={hideIfEmpty}
hideWhenNoResults={hideWhenNoResults}
hasResults={stats.min !== null && stats.max !== null}
onChange={this._refine.bind(this, helper)}
tooltips={tooltips}
Expand Down
6 changes: 3 additions & 3 deletions widgets/refinement-list.js
Expand Up @@ -32,7 +32,7 @@ var defaults = require('lodash/object/defaults');
* @param {Function} [options.transformData] Function to change the object passed to the item template
* @param {String|Function} [options.singleRefine=true] Are multiple refinements allowed or only one at the same time. You can use this
* to build radio based refinement lists for example
* @param {boolean} [hideIfEmpty=true] Hide the container when no results match
* @param {boolean} [hideWhenNoResults=true] Hide the container when no results match
* @return {Object}
*/
function refinementList({
Expand All @@ -46,7 +46,7 @@ function refinementList({
list: null,
item: null
},
hideIfEmpty = true,
hideWhenNoResults = true,
templates = defaultTemplates,
transformData = null,
singleRefine = false
Expand Down Expand Up @@ -87,7 +87,7 @@ function refinementList({
facetValues={facetValues}
templates={templates}
transformData={transformData}
hideIfEmpty={hideIfEmpty}
hideWhenNoResults={hideWhenNoResults}
hasResults={facetValues.length > 0}
toggleRefinement={toggleRefinement.bind(null, helper, singleRefine, facetName)}
/>,
Expand Down
4 changes: 2 additions & 2 deletions widgets/stats/index.js
Expand Up @@ -7,7 +7,7 @@ function stats({
container = null,
template = defaultTemplate,
transformData = null,
hideIfEmpty = true
hideWhenNoResults = true
}) {
var Stats = require('../../components/Stats');
var containerNode = utils.getContainerNode(container);
Expand All @@ -21,7 +21,7 @@ function stats({
React.render(
<Stats
hasResults={results.hits.length > 0}
hideIfEmpty={hideIfEmpty}
hideWhenNoResults={hideWhenNoResults}
hitsPerPage={results.hitsPerPage}
nbHits={results.nbHits}
nbPages={results.nbPages}
Expand Down
6 changes: 3 additions & 3 deletions widgets/toggle.js
Expand Up @@ -12,7 +12,7 @@ var defaultTemplate = '<label>{{label}}<input type="checkbox" {{#isRefined}}chec
* @param {String} options.label Human-readable name of the filter (eg. "Free Shipping")
* @param {String|Function} [options.template] Item template, provided with `label` and `isRefined`
* @param {Function} [options.transformData] Function to change the object passed to the item template
* @param {boolean} [hideIfEmpty=true] Hide the container when no results match
* @param {boolean} [hideWhenNoResults=true] Hide the container when no results match
* @return {Object}
*/
function toggle({
Expand All @@ -21,7 +21,7 @@ function toggle({
label = null,
template = defaultTemplate,
transformData = null,
hideIfEmpty = true
hideWhenNoResults = true
}) {
var Toggle = require('../components/Toggle');

Expand Down Expand Up @@ -50,7 +50,7 @@ function toggle({
label={label}
template={template}
transformData={transformData}
hideIfEmpty={hideIfEmpty}
hideWhenNoResults={hideWhenNoResults}
hasResults={results.hits.length > 0}
toggleFilter={toggleFilter}
/>,
Expand Down

0 comments on commit 21877a0

Please sign in to comment.