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

34 lines
809 B
React
Raw Normal View History

2015-08-27 18:24:29 +02:00
var React = require('react');
2015-08-27 22:52:30 +02:00
var AppItem = require('./app-item.jsx');
2015-08-27 18:24:29 +02:00
module.exports = React.createClass({
2015-08-27 22:52:30 +02:00
propTypes: {
items: React.PropTypes.arrayOf(React.PropTypes.object).isRequired,
parentPath: React.PropTypes.oneOfType([
React.PropTypes.string,
React.PropTypes.arrayOf(React.PropTypes.number)
]).isRequired,
onItemClick: React.PropTypes.func.isRequired,
},
2015-08-27 18:24:29 +02:00
render: function() {
2015-08-27 22:52:30 +02:00
var parentPath = this.props.parentPath;
var items = (this.props.items).map(function(item, i) {
var path = parentPath+'.'+i;
return (
<AppItem key={path} itemPath={path} item={item} onItemClick={this.props.onItemClick} />
);
}.bind(this));
2015-08-27 18:24:29 +02:00
return (
2015-08-27 22:52:30 +02:00
<ul key={parentPath} className="apps-list">
{items}
2015-08-27 18:24:29 +02:00
</ul>
);
2015-08-27 22:52:30 +02:00
2015-08-27 18:24:29 +02:00
}
});