Skip to content

Commit

Permalink
[FontIcon] improve performance when no hoverColor is set
Browse files Browse the repository at this point in the history
do not rerender when hoverColor is not set.
  • Loading branch information
cgestes authored and JAStanton committed Jul 30, 2015
1 parent b23ccc7 commit 6f95b12
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/font-icon.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,18 @@ let FontIcon = React.createClass({
},

_handleMouseLeave(e) {
this.setState({hovered: false});
// hover is needed only when a hoverColor is defined
if (this.props.hoverColor !== undefined)
this.setState({hovered: false});
if (this.props.onMouseLeave) {
this.props.onMouseLeave(e);
}
},

_handleMouseEnter(e) {
this.setState({hovered: true});
// hover is needed only when a hoverColor is defined
if (this.props.hoverColor !== undefined)
this.setState({hovered: true});
if (this.props.onMouseEnter) {
this.props.onMouseEnter(e);
}
Expand Down

0 comments on commit 6f95b12

Please sign in to comment.