diff --git a/js/components/ascribe_piece_list_toolbar/piece_list_toolbar.js b/js/components/ascribe_piece_list_toolbar/piece_list_toolbar.js index 60370431..bcc15603 100644 --- a/js/components/ascribe_piece_list_toolbar/piece_list_toolbar.js +++ b/js/components/ascribe_piece_list_toolbar/piece_list_toolbar.js @@ -39,30 +39,6 @@ let PieceListToolbar = React.createClass({ ]) }, - getFilterWidget(){ - if (this.props.filterParams){ - return ( - - ); - } - return null; - }, - - getOrderWidget(){ - if (this.props.orderParams){ - return ( - - ); - } - return null; - }, - render() { const { className, children, searchFor, searchQuery } = this.props; @@ -75,8 +51,14 @@ let PieceListToolbar = React.createClass({ {children} - {this.getOrderWidget()} - {this.getFilterWidget()} + + 0) { + if (trueValuesOnly.length) { return { visibility: 'visible'}; } else { return { visibility: 'hidden' }; @@ -81,7 +81,7 @@ let PieceListToolbarFilterWidget = React.createClass({ ); - if(this.props.filterParams.length) { + if (this.props.filterParams && this.props.filterParams.length) { return ( 0) { + if (this.props.orderBy && this.props.orderBy.length) { return { visibility: 'visible'}; } else { return { visibility: 'hidden' }; @@ -51,37 +51,41 @@ let PieceListToolbarOrderWidget = React.createClass({ · ); - return ( - - - {getLangText('Sort by')}: - - {this.props.orderParams.map((param) => { - return ( - - - - - {getLangText(param.replace('_', ' '))} - - -1} /> - - - - ); - })} - - ); + if (this.props.orderParams && this.props.orderParams.length) { + return ( + + + {getLangText('Sort by')}: + + {this.props.orderParams.map((param) => { + return ( + + + + + {getLangText(param.replace('_', ' '))} + + -1} /> + + + + ); + })} + + ); + } else { + return null; + } } });