sortdropdown.jsx 1.2 KB

123456789101112131415161718192021222324252627282930
  1. var Preact = require('preact');
  2. var h = require('preact').h;
  3. var createClass = require('preact-compat').createClass;
  4. var SortButton = require('./sortbutton.jsx');
  5. var SortCriteria = require('./SortCriteria');
  6. var SortDropdown = createClass({
  7. render: function() {
  8. var downloadsButton;
  9. if(this.props.downloadsEnabled) {
  10. downloadsButton = <SortButton setSort={this.props.setSort} criteria={SortCriteria.Downloads}/>;
  11. }
  12. return (
  13. <div className="dropdown plugins-sort-dropdown">
  14. <button className="btn btn-primary btn-block dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
  15. <strong>Sort: </strong>{this.props.selected}
  16. <span className="caret"></span>
  17. </button>
  18. <ul className="dropdown-menu" aria-labelledby="dropdownMenu1">
  19. <SortButton setSort={this.props.setSort} criteria={SortCriteria.Quality}/>
  20. <SortButton setSort={this.props.setSort} criteria={SortCriteria.RecentlyUpdated}/>
  21. {downloadsButton}
  22. </ul>
  23. </div>
  24. );
  25. }
  26. });
  27. module.exports = SortDropdown;