File tree Expand file tree Collapse file tree 1 file changed +31
-6
lines changed
src/components/guided-modal-tour Expand file tree Collapse file tree 1 file changed +31
-6
lines changed Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ const NOOP = () => {}
49
49
const GuidedModalTour = props => {
50
50
const {
51
51
steps = STEPS ,
52
+ hasConfetti = true ,
52
53
tourId = '' , // This is the ID of the tour, this will be used to store the tour state in the database.
53
54
} = props
54
55
@@ -61,6 +62,7 @@ const GuidedModalTour = props => {
61
62
62
63
return < ModalTour
63
64
steps = { steps }
65
+ hasConfetti = { hasConfetti }
64
66
onClose = { ( ) => {
65
67
// TODO: Save the tour state to the database that we finished it.
66
68
setIsDone ( true )
@@ -72,6 +74,7 @@ const ModalTour = props => {
72
74
const {
73
75
steps = STEPS ,
74
76
onClose = NOOP ,
77
+ hasConfetti = true ,
75
78
} = props
76
79
77
80
const [ currentStep , setCurrentStep ] = useState ( 0 )
@@ -236,12 +239,34 @@ const ModalTour = props => {
236
239
variant = "primary"
237
240
onClick = { ( ) => {
238
241
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
+ }
245
270
onClose ( )
246
271
} else {
247
272
setCurrentStep ( currentStep + 1 )
You can’t perform that action at this time.
0 commit comments