pitaya-launcher/js/components/category-header.jsx

31 lines
719 B
JavaScript

var React = require('react');
module.exports = React.createClass({
propTypes: {
onBackClick: React.PropTypes.func.isRequired,
itemPath: React.PropTypes.oneOfType([
React.PropTypes.string,
React.PropTypes.arrayOf(React.PropTypes.number)
]).isRequired,
item: React.PropTypes.object.isRequired,
},
render: function() {
return (
<div className="category-header">
<a href="#" onClick={this._onBackClick} className="goback" >&#9668;</a>
<span className="category-label">{this.props.item.label}</span>
</div>
);
},
_onBackClick: function(evt) {
evt.preventDefault();
this.props.onBackClick(this.props.itemPath, this.props.item);
}
});