Skip to content

Commit

Permalink
Modal animation for mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
Albermonte committed Sep 9, 2023
1 parent 55e1e92 commit 75eb851
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
15 changes: 11 additions & 4 deletions src/components/atoms/Modal.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<script setup lang="ts">
import { Dialog, DialogDescription, DialogPanel, DialogTitle, TransitionChild, TransitionRoot } from '@headlessui/vue'
import { ref, useSlots } from 'vue'
import { useBreakpoints } from '@vueuse/core'
import { screens } from 'tailwindcss-nimiq-theme'
import CrossIcon from '@/components/icons/icon-cross.vue'
const emit = defineEmits({
Expand All @@ -9,6 +11,7 @@ const emit = defineEmits({
})
const isOpen = ref(false)
const isMobile = useBreakpoints(screens).smaller('md')
function closeModal() {
isOpen.value = false
Expand Down Expand Up @@ -38,11 +41,15 @@ function hasSlot(slot: 'pre-title' | 'title') {
</TransitionChild>

<div class="fixed inset-x-0 bottom-0 overflow-y-auto md:inset-0">
<div class="flex items-center justify-center min-h-full text-center">
<div class="flex items-center justify-center min-h-full overflow-hidden text-center">
<TransitionChild
as="template" enter="duration-300 ease-out" enter-from="opacity-0 scale-95"
enter-to="opacity-100 scale-100" leave="duration-200 ease-in" leave-from="opacity-100 scale-100"
leave-to="opacity-0 scale-95"
as="template"
enter="duration-300 ease-out"
leave="duration-200 ease-in"
:enter-from="`${isMobile ? 'translate-y-full' : ''} opacity-0 scale-95`"
:enter-to="`${isMobile ? 'translate-y-0' : ''} opacity-100 scale-100`"
:leave-from="`${isMobile ? 'translate-y-0' : ''} opacity-100 scale-100`"
:leave-to="`${isMobile ? 'translate-y-full' : ''} opacity-0 scale-95`"
>
<DialogPanel
class="relative w-full px-6 py-8 text-left align-middle transition-all transform bg-white rounded-t-lg shadow-lg md:px-10 md:rounded-lg md:max-w-lg"
Expand Down
4 changes: 2 additions & 2 deletions src/components/elements/TheMapInstance.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { storeToRefs } from 'pinia'
import { useRoute } from 'vue-router'
import { GoogleMap } from 'vue3-google-map'
import { useMap } from '@/stores/map'
import { detectLanguage } from '@/i18n/i18n-setup'
import { i18n } from '@/i18n/i18n-setup'
import { useInitialMapPosition } from '@/composables/useInitialMapPosition'
import MapMarkers from '@/components/elements/MapMarkers.vue'
Expand Down Expand Up @@ -42,7 +42,7 @@ const mapGestureBehaviour

<template>
<GoogleMap
ref="mapInstance" :language="detectLanguage()" disable-default-ui :gesture-handling="mapGestureBehaviour" :keyboard-shortcuts="false"
ref="mapInstance" :language="i18n.locale" disable-default-ui :gesture-handling="mapGestureBehaviour" :keyboard-shortcuts="false"

This comment has been minimized.

Copy link
@onmax

onmax Sep 11, 2023

Member

Did you check if this is reactive?

Meaning, if you change language, it changes the map names?

This comment has been minimized.

Copy link
@Albermonte

Albermonte Sep 11, 2023

Author Member

It is reactive, but there's no way to change the maps names until it's reloaded, and the library doesn't allow that.
inocan-group/vue3-google-map#18 (comment)

class="w-full h-full" :styles="googleMapStyles" :max-zoom="21" :min-zoom="3" :restriction="restriction" :clickable-icons="false"
@idle.once="setInitialMapPosition"
>
Expand Down

0 comments on commit 75eb851

Please sign in to comment.