Skip to content

Commit

Permalink
Confetti on top of navbar (dexlab-io#78)
Browse files Browse the repository at this point in the history
* Stores the confetti's z-index value on the component's state
* Dynamically changes this value when the animation starts and stops
  • Loading branch information
Emilio Silva Schlenker committed Mar 14, 2019
1 parent 0f7fcf3 commit e8579a3
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/pages/Dashboard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class Dashboard extends Component {
tipHashes: [],
confettiRun: false,
confettiRec: false,
confettiZ: -1,
};
}

Expand Down Expand Up @@ -71,9 +72,13 @@ class Dashboard extends Component {
this.setState({
confettiRun: true,
confettiRec: true,
confettiZ: 2,
});
window.setTimeout(() => {
this.setState({ confettiRec: false });
this.setState({
confettiRec: false,
confettiZ: -1,
});
}, 5000);
}

Expand Down Expand Up @@ -124,7 +129,7 @@ class Dashboard extends Component {
) : null}
</Layout>
<Confetti
style={ { zIndex: -1 } }
style={ { zIndex: this.state.confettiZ } }
run={this.state.confettiRun}
recycle={this.state.confettiRec}
numberOfPieces={600}
Expand Down

0 comments on commit e8579a3

Please sign in to comment.