Skip to content

Commit

Permalink
fix(showMore): hide showMore when no more facet values to show
Browse files Browse the repository at this point in the history
If number of facet values is 5 and limit is 5 then we were still
displaying the showMore button.

Now fixed, no added tests, waiting for
#948

This is a hotfix
  • Loading branch information
vvo committed Apr 14, 2016
1 parent a01a6f9 commit cc31b1a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/components/RefinementList/RefinementList.js
Expand Up @@ -129,9 +129,11 @@ class RefinementList extends React.Component {

const limit = this.state.isShowMoreOpen ? this.props.limitMax : this.props.limitMin;
let displayedFacetValues = this.props.facetValues.slice(0, limit);
const displayShowMore = this.props.showMore === true &&
this.props.facetValues.length > displayedFacetValues.length ||
this.state.isShowMoreOpen === true;

const showMoreBtn =
this.props.showMore ?
const showMoreBtn = displayShowMore ?
<Template
rootProps={{onClick: this.handleClickShowMore}}
templateKey={'show-more-' + (this.state.isShowMoreOpen ? 'active' : 'inactive')}
Expand Down

0 comments on commit cc31b1a

Please sign in to comment.