3737 />
3838 <help-section />
3939 </div >
40- <div class =" column" >
40+ <div class =" column right-column" >
41+ <!-- The right column with the recommended license should be fixed until
42+ the 'LicenseUseCard' appears, when the column should scroll to make the
43+ 'LicenseUseCard' visible -->
4144 <div :class =" { 'fixed-right-column': !showLicenseUse }" >
4245 <transition name =" appear" >
4346 <LicenseDetailsCard
4447 v-if =" showLicense"
4548 />
4649 </transition >
47-
48- <LicenseUseCard
49- v-if =" showLicenseUse"
50- ref =" licenseUseCard"
51- :class =" { 'shake' : shouldShake}"
52- />
50+ <transition name =" appear" >
51+ <LicenseUseCard
52+ v-if =" showLicenseUse"
53+ ref =" licenseUseCard"
54+ :class =" { 'shake' : shouldShake}"
55+ />
56+ </transition >
5357 </div >
5458 </div >
5559 </div >
@@ -82,20 +86,41 @@ export default {
8286 return {
8387 currentStepId: 0 ,
8488 showLicense: false ,
85- shouldShake: false
89+ shouldShake: false ,
90+ windowWidth: window .innerWidth
8691 }
8792 },
8893 computed: {
8994 showLicenseUse () {
9095 return this .currentStepId === 7
96+ },
97+ isBelowTabletWidth () {
98+ return this .windowWidth < 769
9199 }
92100 },
93101 watch: {
94- currentStepId (newId ) {
95- const offset = newId === 7 ? - 200 : - 120
96- this .$scrollTo (` .step-${ newId} ` , { offset: offset })
102+ async currentStepId (newId , oldId ) {
103+ // When the new step opens, the page is scrolled to the top of the
104+ // previous step. When the 'Back' button is clicked, the page is
105+ // scrolled to the previous step.
106+ // If the user chooses No attribution, the page is scrolled to the top
107+ // of the disabled steps, i.e. step 2.
108+ let stepToScroll = newId === 6 ? 2 : Math .min (newId, oldId)
109+ if (newId === 6 ) {
110+ stepToScroll = 2
111+ }
112+ await this .$nextTick ()
113+ this .$scrollTo (` .step-${ stepToScroll} ` )
97114 }
98115 },
116+ mounted () {
117+ this .$nextTick (() => {
118+ window .addEventListener (' resize' , this .onResize )
119+ })
120+ },
121+ beforeDestroy () {
122+ window .removeEventListener (' resize' , this .onResize )
123+ },
99124 created : function () {
100125 // send home to google analytics
101126 if (process .env .NODE_ENV === ' production' ) {
@@ -113,13 +138,18 @@ export default {
113138 this .showLicense = 0
114139 },
115140 done () {
116- const scrollDuration = 800
117- const shakeDuration = 3000
141+ // Add 'shake' class that triggers animation to the 'LicenseUseCard',
142+ // when 'Done' button is clicked, after the scroll has finished.
143+ //
144+ const scrollDuration = this .isBelowTabletWidth ? 3000 : 800
145+ const shakeDuration = 3000 + scrollDuration
118146 const comp = this
119-
120147 setTimeout (() => { comp .shouldShake = true }, scrollDuration)
121148 setTimeout (() => { comp .shouldShake = false }, shakeDuration)
122- this .$scrollTo (this .$refs .licenseUseCard .$el , 800 )
149+ this .$scrollTo (this .$refs .licenseUseCard .$el , scrollDuration)
150+ },
151+ onResize () {
152+ this .windowWidth = window .innerWidth
123153 }
124154 }
125155}
@@ -144,7 +174,7 @@ export default {
144174 @import ' ~buefy/src/scss/components/_form.scss' ;
145175 @import ' ~buefy/src/scss/components/_icon.scss' ;
146176
147- @import " @creativecommons/vocabulary/scss/vocabulary.scss" ;
177+ @import " ~ @creativecommons/vocabulary/scss/vocabulary.scss" ;
148178
149179 #app {
150180 -webkit-font-smoothing : antialiased ;
@@ -227,14 +257,12 @@ export default {
227257
228258 }
229259 .appear-enter-active {
230- transition : all .8s ease ;
260+ transition : opacity .8s ease ;
231261 }
232262 .appear-leave-active {
233- transition : all .3s cubic-bezier (1.0 , 0.5 , 0.8 , 1.0 );
263+ transition : opacity .3s cubic-bezier (1.0 , 0.5 , 0.8 , 1.0 );
234264 }
235- .appear-enter , .appear-leave-to
236- /* .appear-leave-active below version 2.1.8 */ {
237- transform : translateY (-10px );
265+ .appear-enter , .appear-leave-to {
238266 opacity : 0 ;
239267 }
240268 </style >
0 commit comments