render modals into the “modal” portal

This commit is contained in:
taehoon 2019-10-18 11:53:38 -04:00
parent d502baaffc
commit a41ffea146
5 changed files with 36 additions and 20 deletions

View file

@ -120,7 +120,7 @@
<MobilePostStatusButton />
<UserReportingModal />
<PostStatusModal />
<portal-target name="modal" />
<portal-target name="modal" multiple />
</div>
</template>

View file

@ -1,7 +1,7 @@
<template>
<Modal
v-if="showing"
class="media-modal-view"
view-class="media-modal-view"
@close="hide"
>
<img

View file

@ -0,0 +1,20 @@
import Vue from 'vue'
const Modal = {
props: {
viewClass: {
type: String
},
isOpen: {
type: Boolean,
default: true
}
},
methods: {
closeModal () {
this.$emit('close')
}
}
}
export default Modal

View file

@ -1,22 +1,18 @@
<template>
<div
v-body-scroll-lock="true"
class="modal-view"
@click.self="closeModal"
>
<slot />
</div>
<portal to="modal">
<div
ref="view"
v-body-scroll-lock="isOpen"
v-show="isOpen"
:class="['modal-view', viewClass]"
@click.self="closeModal"
>
<slot />
</div>
</portal>
</template>
<script>
export default {
methods: {
closeModal () {
this.$emit('close')
}
}
}
</script>
<script src="./modal.js"></script>
<style lang="scss">
.modal-view {

View file

@ -1,8 +1,8 @@
<template>
<Modal
v-if="isLoggedIn && !resettingForm"
v-show="modalActivated"
class="post-form-modal-view"
:is-open="modalActivated"
view-class="post-form-modal-view"
@close="closeModal"
>
<div class="post-form-modal-panel panel">