Skip to content

Commit ebd50b9

Browse files
authored
Merge pull request #405 from devforth/AdminForth/312
fix: remove white strip from the AcceptModal while scroling on mobile
2 parents 67a726d + b3884e4 commit ebd50b9

File tree

1 file changed

+42
-9
lines changed

1 file changed

+42
-9
lines changed

adminforth/spa/src/components/AcceptModal.vue

Lines changed: 42 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
1-
<script setup lang="ts">
2-
import { useModalStore } from '@/stores/modal';
3-
4-
const modalStore = useModalStore();
5-
</script>
6-
71
<template>
82
<Teleport to="body">
9-
<div v-if="modalStore.isOpened" class="bg-gray-900/50 dark:bg-gray-900/80 overflow-y-auto overflow-x-hidden fixed top-0 right-0 left-0 z-[100] justify-center items-center w-full md:inset-0 h-full max-h-full">
10-
<div class="relative p-4 w-full max-w-md max-h-full top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 " >
3+
<div ref="modalEl" tabindex="-1" aria-hidden="true" class="hidden fixed inset-0 z-50 w-full h-full overflow-y-auto overflow-x-hidden flex items-center justify-center">
4+
<div class="relative p-4 w-full max-w-md max-h-full" >
115
<div class="afcl-confirmation-container relative bg-lightAcceptModalBackground rounded-lg shadow dark:bg-darkAcceptModalBackground dark:shadow-black">
12-
<button type="button"@click="modalStore.togleModal" class="absolute top-3 end-2.5 text-lightAcceptModalCloseIcon bg-transparent hover:bg-lightAcceptModalCloseIconHoverBackground hover:text-lightAcceptModalCloseIconHover rounded-lg text-sm w-8 h-8 ms-auto inline-flex justify-center items-center dark:text-darkAcceptModalCloseIcon dark:hover:bg-darkAcceptModalCloseIconHoverBackground dark:hover:text-darkAcceptModalCloseIconHover" >
6+
<button type="button" @click="modalStore.togleModal" class="absolute top-3 end-2.5 text-lightAcceptModalCloseIcon bg-transparent hover:bg-lightAcceptModalCloseIconHoverBackground hover:text-lightAcceptModalCloseIconHover rounded-lg text-sm w-8 h-8 ms-auto inline-flex justify-center items-center dark:text-darkAcceptModalCloseIcon dark:hover:bg-darkAcceptModalCloseIconHoverBackground dark:hover:text-darkAcceptModalCloseIconHover" >
137
<svg class="w-3 h-3" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 14 14">
148
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m1 1 6 6m0 0 6 6M7 7l6-6M7 7l-6 6"/>
159
</svg>
@@ -32,6 +26,45 @@ const modalStore = useModalStore();
3226
</Teleport>
3327
</template>
3428

29+
<script setup lang="ts">
30+
import { watch, onMounted, nextTick, ref } from 'vue';
31+
import { useModalStore } from '@/stores/modal';
32+
import { Modal } from 'flowbite';
33+
34+
const modalStore = useModalStore();
35+
const modalEl = ref(null);
36+
const modal = ref(null);
37+
38+
watch( () => modalStore.isOpened, (newVal) => {
39+
if (newVal) {
40+
open();
41+
} else {
42+
close();
43+
}
44+
}
45+
);
46+
47+
onMounted(async () => {
48+
await nextTick();
49+
modal.value = new Modal(
50+
modalEl.value,
51+
{
52+
closable: true,
53+
backdrop: 'static',
54+
}
55+
);
56+
})
57+
58+
function open() {
59+
modal.value?.show();
60+
}
61+
62+
function close() {
63+
modal.value?.hide();
64+
}
65+
66+
</script>
67+
3568
<style scoped>
3669
.modal {
3770
position: fixed;

0 commit comments

Comments
 (0)