2016-10-21 23:27:50 +13:00
|
|
|
|
|
|
|
|
import React, { PropTypes } from 'react'
|
|
|
|
|
import FontAwesome from 'react-fontawesome'
|
|
|
|
|
import { browserHistory } from 'react-router'
|
|
|
|
|
|
|
|
|
|
export default class ListItem extends React.Component{
|
|
|
|
|
|
|
|
|
|
constructor(props) {
|
|
|
|
|
super(props);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
handleClick(e){
|
2016-10-25 17:01:37 +13:00
|
|
|
if( e.target.tagName.toLowerCase() !== 'a' ){
|
|
|
|
|
browserHistory.push( this.props.link );
|
|
|
|
|
}
|
2016-10-21 23:27:50 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
render(){
|
|
|
|
|
var className = 'list-item';
|
|
|
|
|
if( this.props.extraClasses ) className += ' '+this.props.extraClasses;
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<li className={className} onClick={ (e) => this.handleClick(e) }>
|
|
|
|
|
{ this.props.children }
|
|
|
|
|
</li>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|