import { Motion, spring } from 'react-motion'; import PropTypes from 'prop-types'; class IconButton extends React.PureComponent { constructor (props, context) { super(props, context); this.handleClick = this.handleClick.bind(this); } handleClick (e) { e.preventDefault(); if (!this.props.disabled) { this.props.onClick(e); } } render () { let style = { fontSize: `${this.props.size}px`, width: `${this.props.size * 1.28571429}px`, height: `${this.props.size * 1.28571429}px`, lineHeight: `${this.props.size}px`, ...this.props.style }; if (this.props.active) { style = { ...style, ...this.props.activeStyle }; } const classes = ['icon-button']; if (this.props.active) { classes.push('active'); } if (this.props.disabled) { classes.push('disabled'); } if (this.props.inverted) { classes.push('inverted'); } if (this.props.overlay) { classes.push('overlayed'); } return ( {({ rotate }) =>