Skip to content

Commit 03f491e

Browse files
added hasConfetti prop
1 parent 23c79b4 commit 03f491e

File tree

1 file changed

+31
-6
lines changed
  • src/components/guided-modal-tour

1 file changed

+31
-6
lines changed

src/components/guided-modal-tour/index.js

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ const NOOP = () => {}
4949
const GuidedModalTour = props => {
5050
const {
5151
steps = STEPS,
52+
hasConfetti = true,
5253
tourId = '', // This is the ID of the tour, this will be used to store the tour state in the database.
5354
} = props
5455

@@ -61,6 +62,7 @@ const GuidedModalTour = props => {
6162

6263
return <ModalTour
6364
steps={ steps }
65+
hasConfetti={ hasConfetti }
6466
onClose={ () => {
6567
// TODO: Save the tour state to the database that we finished it.
6668
setIsDone( true )
@@ -72,6 +74,7 @@ const ModalTour = props => {
7274
const {
7375
steps = STEPS,
7476
onClose = NOOP,
77+
hasConfetti = true,
7578
} = props
7679

7780
const [ currentStep, setCurrentStep ] = useState( 0 )
@@ -236,12 +239,34 @@ const ModalTour = props => {
236239
variant="primary"
237240
onClick={ () => {
238241
if ( currentStep === steps.length - 1 ) {
239-
confetti( {
240-
angle: -90,
241-
spread: 90,
242-
origin: { y: -0.3 },
243-
zIndex: 100000,
244-
} )
242+
if ( hasConfetti ) {
243+
confetti( {
244+
particleCount: 50,
245+
angle: 60,
246+
spread: 70,
247+
origin: { x: 0 },
248+
zIndex: 100000,
249+
disableForReducedMotion: true,
250+
} )
251+
confetti( {
252+
particleCount: 50,
253+
angle: 120,
254+
spread: 70,
255+
origin: { x: 1 },
256+
zIndex: 100000,
257+
disableForReducedMotion: true,
258+
} )
259+
setTimeout( () => {
260+
confetti( {
261+
particleCount: 50,
262+
angle: -90,
263+
spread: 90,
264+
origin: { y: -0.3 },
265+
zIndex: 100000,
266+
disableForReducedMotion: true,
267+
} )
268+
}, 150 )
269+
}
245270
onClose()
246271
} else {
247272
setCurrentStep( currentStep + 1 )

0 commit comments

Comments
 (0)