import React, { PropTypes } from 'react'; import FontAwesome from 'react-fontawesome'; export default class Icon extends React.Component{ constructor(props){ super(props); } handleClick(e){ if (this.props.onClick){ this.props.onClick(e); } } render(){ var className = "icon"; if (this.props.className){ className += ' '+this.props.className; } switch (this.props.type){ case 'fontawesome': return this.handleClick(e)} />; default: className += ' material-icon'; return this.handleClick(e)}>{this.props.name}; } } }