Created
February 8, 2018 15:09
-
-
Save ramsaylanier/086d7495582e43497e77938b07e119be to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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