Files
Iris/src/js/components/Icon.js

32 lines
730 B
JavaScript
Raw Normal View History

import React, { PropTypes } from 'react';
2018-05-15 21:30:57 +12:00
import FontAwesome from 'react-fontawesome';
2018-05-13 16:03:51 +12:00
export default class Icon extends React.Component{
2017-10-10 13:05:28 +13:00
constructor(props){
super(props);
}
2018-05-20 20:42:20 +12:00
handleClick(e){
if (this.props.onClick){
this.props.onClick(e);
}
}
render(){
2018-05-15 21:30:57 +12:00
var className = "icon";
if (this.props.className){
className += ' '+this.props.className;
}
2018-05-15 21:30:57 +12:00
switch (this.props.type){
case 'fontawesome':
2018-05-22 17:01:20 +12:00
return <FontAwesome className="icon" type="fontawesome" name={this.props.name} onClick={e => this.handleClick(e)} />;
2018-05-15 21:30:57 +12:00
default:
2018-05-16 16:50:46 +12:00
className += ' material-icon';
2018-05-20 20:42:20 +12:00
return <i className={className} onClick={e => this.handleClick(e)}>{this.props.name}</i>;
2018-05-15 21:30:57 +12:00
}
}
2018-05-13 16:03:51 +12:00
}