Skip to content

Commit

Permalink
fix(FEC-6936): hover timeout for the player ui. (#23)
Browse files Browse the repository at this point in the history
* fix(FEC-6936): hover timeout for the player Ui.

* fix: configurable hoverTimeout

* flow type change
  • Loading branch information
Dvir Hazout committed Aug 14, 2017
1 parent 8aee597 commit f9de374
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/components/shell/shell.js
Expand Up @@ -18,6 +18,7 @@ const mapStateToProps = state => ({
@connect(mapStateToProps, bindActions(actions))
class Shell extends BaseComponent {
state: Object;
hoverTimeout: number;

constructor(obj: Object) {
super({name: 'Shell', player: obj.player});
Expand All @@ -28,6 +29,13 @@ class Shell extends BaseComponent {
this.props.addPlayerClass('hover');
this.setState({hover: true});
}
if (this.hoverTimeout) {
clearTimeout(this.hoverTimeout);
}
this.hoverTimeout = setTimeout(() => {
this.props.removePlayerClass('hover');
this.setState({hover: false});
}, this.props.hoverTimeout || 3000);
}

onMouseLeave() {
Expand Down

0 comments on commit f9de374

Please sign in to comment.