var React = require('react');
var AppIcon = require('../common/app-icon.jsx');

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} />
        <span className="app-label">{this.props.item.label}</span>
      </li>
    );
  }

});
