pitaya-launcher/js/components/launcher/app-item.js

30 lines
765 B
JavaScript
Raw Normal View History

2015-08-27 22:52:30 +02:00
var React = require('react');
var AppIcon = require('../common/app-icon.js');
2015-08-27 22:52:30 +02:00
module.exports = React.createClass({
propTypes: {
item: React.PropTypes.object.isRequired,
itemPath: React.PropTypes.oneOfType([
React.PropTypes.string,
React.PropTypes.arrayOf(React.PropTypes.number)
]).isRequired,
onItemClick: React.PropTypes.func.isRequired,
},
_onItemClick: function(evt) {
evt.preventDefault();
this.props.onItemClick(evt, this.props.itemPath, this.props.item);
},
render: function() {
return (
<li className="app-item" onClick={this._onItemClick}>
<AppIcon icon={this.props.item.icon} theme={null} />
2015-08-27 22:52:30 +02:00
<span className="app-label">{this.props.item.label}</span>
</li>
);
}
});