2015-08-31 23:08:56 +02:00
|
|
|
var React = require('react');
|
2015-09-04 12:10:08 +02:00
|
|
|
var Util = require('../../util');
|
2015-08-31 23:08:56 +02:00
|
|
|
|
|
|
|
module.exports = React.createClass({
|
|
|
|
|
|
|
|
propsType: {
|
|
|
|
onThemeSelected: React.PropTypes.func.isRequired,
|
|
|
|
},
|
|
|
|
|
|
|
|
getInitialState: function() {
|
|
|
|
return { selectedTheme: null, availableThemes: [] };
|
|
|
|
},
|
|
|
|
|
|
|
|
componentDidMount: function() {
|
|
|
|
Util.DesktopApps.findIconThemes()
|
|
|
|
.then(function(themes) {
|
|
|
|
this.setState({ availableThemes: themes });
|
|
|
|
}.bind(this))
|
|
|
|
;
|
|
|
|
},
|
|
|
|
|
|
|
|
onChange: function(evt) {
|
|
|
|
var selectedTheme = evt.target.value;
|
|
|
|
this.setState({ selectedTheme: selectedTheme });
|
|
|
|
this.props.onThemeSelected(selectedTheme);
|
|
|
|
},
|
|
|
|
|
|
|
|
render: function() {
|
|
|
|
|
|
|
|
var selectedTheme = this.state.selectedTheme;
|
|
|
|
var options = this.state.availableThemes.map(function(theme) {
|
|
|
|
return (
|
|
|
|
<option key={theme} value={theme}>{theme}</option>
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
2015-09-02 14:26:23 +02:00
|
|
|
options.unshift(
|
|
|
|
<option key="__none__"></option>
|
|
|
|
);
|
|
|
|
|
2015-08-31 23:08:56 +02:00
|
|
|
return (
|
|
|
|
<select value={selectedTheme} onChange={this.onChange}>
|
|
|
|
{options}
|
|
|
|
</select>
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|