Lanceur d’application pour GNU/Linux
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
992B

  1. var React = require('react');
  2. var Util = require('../util');
  3. module.exports = React.createClass({
  4. propsType: {
  5. onThemeSelected: React.PropTypes.func.isRequired,
  6. },
  7. getInitialState: function() {
  8. return { selectedTheme: null, availableThemes: [] };
  9. },
  10. componentDidMount: function() {
  11. Util.DesktopApps.findIconThemes()
  12. .then(function(themes) {
  13. this.setState({ availableThemes: themes });
  14. }.bind(this))
  15. ;
  16. },
  17. onChange: function(evt) {
  18. var selectedTheme = evt.target.value;
  19. this.setState({ selectedTheme: selectedTheme });
  20. this.props.onThemeSelected(selectedTheme);
  21. },
  22. render: function() {
  23. var selectedTheme = this.state.selectedTheme;
  24. var options = this.state.availableThemes.map(function(theme) {
  25. return (
  26. <option key={theme} value={theme}>{theme}</option>
  27. );
  28. });
  29. return (
  30. <select value={selectedTheme} onChange={this.onChange}>
  31. {options}
  32. </select>
  33. );
  34. }
  35. });