2018-03-26 23:32:43 +02:00
|
|
|
// @flow
|
|
|
|
import React from 'react';
|
|
|
|
// import * as icons from 'constants/icons';
|
|
|
|
import * as FeatherIcons from 'react-feather';
|
|
|
|
import * as icons from 'constants/icons';
|
|
|
|
|
|
|
|
const RED_COLOR = '#e2495e';
|
|
|
|
|
|
|
|
type Props = {
|
|
|
|
icon: string,
|
|
|
|
};
|
|
|
|
|
|
|
|
class IconComponent extends React.PureComponent<Props> {
|
|
|
|
// TODO: Move all icons to constants and add titles for all
|
|
|
|
// Add some some sort of hover flyout with the title?
|
|
|
|
|
|
|
|
render() {
|
|
|
|
const { icon } = this.props;
|
|
|
|
const Icon = FeatherIcons[icon];
|
|
|
|
|
|
|
|
let color;
|
2018-04-03 02:59:34 +02:00
|
|
|
if (icon === icons.HEART || icon === icons.FEATURED) {
|
2018-03-26 23:32:43 +02:00
|
|
|
color = RED_COLOR;
|
|
|
|
}
|
|
|
|
|
|
|
|
let size = 14;
|
|
|
|
if (icon === icons.ARROW_LEFT || icon === icons.ARROW_RIGHT) {
|
2018-05-11 20:15:29 +02:00
|
|
|
size = 20;
|
2018-03-26 23:32:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return Icon ? <Icon size={size} className="icon" color={color} /> : null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default IconComponent;
|