pitaya-launcher/js/components/desktop-app-list.jsx

40 lines
1005 B
React
Raw Normal View History

2015-08-28 14:20:07 +02:00
var React = require('react');
var Util = require('../util');
var DesktopAppItem = require('./desktop-app-item.jsx');
2015-08-31 23:08:56 +02:00
var IconThemeSelector = require('./icon-theme-selector.jsx');
var path = require('path');
2015-08-31 23:08:56 +02:00
var debug = require('debug')('pitaya:desktop-app-list');
2015-08-28 14:20:07 +02:00
module.exports = React.createClass({
getInitialState: function() {
return {
2015-08-31 23:08:56 +02:00
selectedTheme: null
2015-08-28 14:20:07 +02:00
};
},
render: function() {
2015-09-03 15:50:23 +02:00
var items = this.props.desktopApps.map(function(desktopApp, i) {
var desktopEntry = desktopApp.content['Desktop Entry'];
return <DesktopAppItem theme={this.state.selectedTheme} key={desktopApp.path} desktopEntry={desktopEntry} />;
2015-08-31 23:08:56 +02:00
}.bind(this));
2015-08-28 14:20:07 +02:00
return (
2015-08-31 23:08:56 +02:00
<div>
<IconThemeSelector onThemeSelected={this.onThemeSelected} />
<ul className="desktop-apps">
{items}
</ul>
</div>
2015-08-28 14:20:07 +02:00
);
2015-08-31 23:08:56 +02:00
},
onThemeSelected: function(theme) {
console.log('Selected theme %s', theme);
this.setState({ selectedTheme: theme });
2015-08-28 14:20:07 +02:00
}
});