-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9322165
commit 03b68d6
Showing
7 changed files
with
86 additions
and
148 deletions.
There are no files selected for viewing
This file contains 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<template> | ||
<div | ||
class="z-40 left-0 right-0 top-0 bottom-0 tg-secondary-bg opacity-0 transition-all duration-600" | ||
:class="{ 'fixed! block! opacity-70': isOpened, 'opacity-0!': isClosing }" | ||
/> | ||
<div | ||
class="z-40 flex flex-col justify-end fixed left-0 right-0 bottom-0 mx-auto w-full max-w-lg max-h-[100dvh] overflow-y-auto p-4 m-0 pb-20 shadow-none translate-y-full transition-transform duration-500" | ||
:class="{ 'top-0! translate-y-0!': isOpened, 'translate-y-full!': isClosing }" | ||
> | ||
<div ref="target" class="mb-10 p-4 md:p-6 lg:p-8 tg-section-bg tg-text rounded-2xl shadow-lg max-h-[70dvh] overflow-y-auto"> | ||
<div class="mb-4 flex flex-row justify-between items-center"> | ||
<h3 class="text-xl md:text-2xl font-medium"> | ||
{{ title }} | ||
</h3> | ||
</div> | ||
|
||
<slot /> | ||
|
||
<button class="mt-4 p-3 tg-button w-full rounded-2xl font-medium" @click="onClose()"> | ||
Закрыть | ||
</button> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { onClickOutside, usePointerSwipe } from '@vueuse/core' | ||
const { isOpened } = defineProps<{ | ||
isOpened: boolean | ||
title: string | ||
}>() | ||
const emit = defineEmits(['close']) | ||
const isClosing = ref(false) | ||
const target = ref(null) | ||
onClickOutside(target, () => isOpened && onClose()) | ||
const { isSwiping, direction } = usePointerSwipe(target) | ||
watch(isSwiping, () => { | ||
if (direction.value === 'down') { | ||
onClose() | ||
} | ||
}) | ||
function onClose() { | ||
isClosing.value = true | ||
setTimeout(() => { | ||
emit('close') | ||
isClosing.value = false | ||
}, 600) | ||
} | ||
</script> |
This file contains 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
This file contains 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
This file contains 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