Skip to content

Instantly share code, notes, and snippets.

@ramsaylanier
Created February 8, 2018 15:09
Show Gist options
  • Save ramsaylanier/086d7495582e43497e77938b07e119be to your computer and use it in GitHub Desktop.
Save ramsaylanier/086d7495582e43497e77938b07e119be to your computer and use it in GitHub Desktop.
<template>
<transition
v-bind:css="false"
v-on:enter="enter"
v-on:leave="leave"
appear
>
<div class="modal">
<div class="inner">
<button class="close-button" @click="handleClose"><close-icon/></button>
<slot></slot>
</div>
</div>
</transition>
</template>
<script>
import {TweenMax, Power4} from 'gsap'
import CloseIcon from '@/components/icons/Close.vue'
export default {
name: 'modal',
components: {
CloseIcon
},
methods: {
enter (el, done) {
TweenMax.fromTo(el, 0.5, {
alpha: 0
}, {
alpha: 1,
ease: Power4.easeOut
})
},
leave (el, done) {
TweenMax.to(el, 0.5, {
alpha: 0,
ease: Power4.easeOut,
onComplete: done
})
},
handleClose () {
this.$router.go(-1)
}
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment