forked from AkkomaGang/akkoma-fe
render modals into the “modal” portal
This commit is contained in:
parent
d502baaffc
commit
a41ffea146
5 changed files with 36 additions and 20 deletions
|
@ -120,7 +120,7 @@
|
|||
<MobilePostStatusButton />
|
||||
<UserReportingModal />
|
||||
<PostStatusModal />
|
||||
<portal-target name="modal" />
|
||||
<portal-target name="modal" multiple />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<Modal
|
||||
v-if="showing"
|
||||
class="media-modal-view"
|
||||
view-class="media-modal-view"
|
||||
@close="hide"
|
||||
>
|
||||
<img
|
||||
|
|
20
src/components/modal/modal.js
Normal file
20
src/components/modal/modal.js
Normal 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
|
|
@ -1,22 +1,18 @@
|
|||
<template>
|
||||
<portal to="modal">
|
||||
<div
|
||||
v-body-scroll-lock="true"
|
||||
class="modal-view"
|
||||
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 {
|
||||
|
|
|
@ -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">
|
||||
|
|
Loading…
Reference in a new issue