mirror of
https://github.com/Drop-OSS/drop-base.git
synced 2025-11-10 04:22:15 +10:00
fix: fade in fade out + styling
This commit is contained in:
@ -1,82 +1,52 @@
|
|||||||
<template>
|
<template>
|
||||||
<TransitionRoot
|
<div class="relative z-50" @close="emit('event', 'cancel')">
|
||||||
as="template"
|
<div class="fixed inset-0 bg-zinc-950/75" />
|
||||||
:show="true"
|
|
||||||
:style="{ 'z-index': props.zHeight }"
|
<div class="fixed inset-0 z-10 w-screen overflow-y-auto">
|
||||||
>
|
<div
|
||||||
<Dialog class="relative z-50" @close="emit('event', 'cancel')">
|
class="flex min-h-full items-start justify-center p-4 text-center sm:items-center sm:p-0"
|
||||||
<TransitionChild
|
|
||||||
as="template"
|
|
||||||
enter="ease-out duration-300"
|
|
||||||
enter-from="opacity-0"
|
|
||||||
enter-to="opacity-100"
|
|
||||||
leave="ease-in duration-200"
|
|
||||||
leave-from="opacity-100"
|
|
||||||
leave-to="opacity-0"
|
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="fixed inset-0 bg-zinc-950 bg-opacity-75 transition-opacity"
|
class="relative transform rounded-lg bg-zinc-900 text-left shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-lg"
|
||||||
/>
|
|
||||||
</TransitionChild>
|
|
||||||
|
|
||||||
<div class="fixed inset-0 z-10 w-screen overflow-y-auto">
|
|
||||||
<div
|
|
||||||
class="flex min-h-full items-start justify-center p-4 text-center sm:items-center sm:p-0"
|
|
||||||
>
|
>
|
||||||
<TransitionChild
|
<div class="px-4 pb-4 pt-5 space-y-4 sm:p-6 sm:pb-4">
|
||||||
as="template"
|
<div class="sm:flex sm:items-start">
|
||||||
enter="ease-out duration-300"
|
<div class="mt-3 text-center sm:mt-0 sm:text-left">
|
||||||
enter-from="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
|
<h3 class="text-base font-semibold text-zinc-100">
|
||||||
enter-to="opacity-100 translate-y-0 sm:scale-100"
|
{{ props.data.title }}
|
||||||
leave="ease-in duration-200"
|
</h3>
|
||||||
leave-from="opacity-100 translate-y-0 sm:scale-100"
|
<div class="mt-2">
|
||||||
leave-to="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
|
<p class="text-sm text-zinc-400">
|
||||||
>
|
{{ props.data.description }}
|
||||||
<div
|
</p>
|
||||||
class="relative transform rounded-lg bg-zinc-900 text-left shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-lg"
|
|
||||||
>
|
|
||||||
<div class="px-4 pb-4 pt-5 space-y-4 sm:p-6 sm:pb-4">
|
|
||||||
<div class="sm:flex sm:items-start">
|
|
||||||
<div class="mt-3 text-center sm:mt-0 sm:text-left">
|
|
||||||
<DialogTitle
|
|
||||||
as="h3"
|
|
||||||
class="text-base font-semibold text-zinc-100"
|
|
||||||
>{{ props.data.title }}
|
|
||||||
</DialogTitle>
|
|
||||||
<div class="mt-2">
|
|
||||||
<p class="text-sm text-zinc-400">
|
|
||||||
{{ props.data.description }}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div
|
|
||||||
class="rounded-b-lg bg-zinc-800 px-4 py-3 sm:flex sm:gap-x-2 sm:flex-row-reverse sm:px-6"
|
|
||||||
>
|
|
||||||
<LoadingButton
|
|
||||||
:loading="props.loading"
|
|
||||||
@click="emit('event', 'confirm')"
|
|
||||||
type="submit"
|
|
||||||
class="w-full sm:w-fit"
|
|
||||||
>
|
|
||||||
{{ props.data.buttonText ?? "Confirm" }}
|
|
||||||
</LoadingButton>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="mt-3 inline-flex w-full justify-center rounded-md bg-zinc-800 px-3 py-2 text-sm font-semibold text-zinc-100 shadow-sm ring-1 ring-inset ring-zinc-700 hover:bg-zinc-900 sm:mt-0 sm:w-auto"
|
|
||||||
@click="emit('event', 'cancel')"
|
|
||||||
ref="cancelButtonRef"
|
|
||||||
>
|
|
||||||
Cancel
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</TransitionChild>
|
</div>
|
||||||
|
<div
|
||||||
|
class="rounded-b-lg bg-zinc-800 px-4 py-3 sm:flex sm:gap-x-2 sm:flex-row-reverse sm:px-6"
|
||||||
|
>
|
||||||
|
<LoadingButton
|
||||||
|
:loading="props.loading"
|
||||||
|
@click="emit('event', 'confirm')"
|
||||||
|
type="submit"
|
||||||
|
class="w-full sm:w-fit"
|
||||||
|
>
|
||||||
|
{{ props.data.buttonText ?? "Confirm" }}
|
||||||
|
</LoadingButton>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="mt-3 inline-flex w-full justify-center rounded-md bg-zinc-800 px-3 py-2 text-sm font-semibold text-zinc-100 shadow-sm ring-1 ring-inset ring-zinc-700 hover:bg-zinc-900 sm:mt-0 sm:w-auto"
|
||||||
|
@click="emit('event', 'cancel')"
|
||||||
|
ref="cancelButtonRef"
|
||||||
|
>
|
||||||
|
Cancel
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Dialog>
|
</div>
|
||||||
</TransitionRoot>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
|||||||
@ -1,15 +1,39 @@
|
|||||||
<template>
|
<template>
|
||||||
<component
|
<TransitionGroup name="modal">
|
||||||
v-for="(modal, modalIdx) in stack"
|
<component
|
||||||
:is="modal.component"
|
v-for="(modal, modalIdx) in stack"
|
||||||
:z-height="(modalIdx + 1) * 50"
|
:key="modal.data"
|
||||||
:loading="modal.loading"
|
:is="modal.component"
|
||||||
:data="modal.data"
|
:z-height="(modalIdx + 1) * 50"
|
||||||
@event="(event: string, ...args: any[]) => handleCallback(modalIdx, event, args)"
|
:loading="modal.loading"
|
||||||
/>
|
:data="modal.data"
|
||||||
|
@event="
|
||||||
|
(event: string, ...args: any[]) => handleCallback(modalIdx, event, args)
|
||||||
|
"
|
||||||
|
/>
|
||||||
|
</TransitionGroup>
|
||||||
<div id="modalstack" />
|
<div id="modalstack" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.modal-enter-active,
|
||||||
|
.modal-leave-active {
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
}
|
||||||
|
.modal-enter-from {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
.modal-enter-to {
|
||||||
|
opacity: 100;
|
||||||
|
}
|
||||||
|
.modal-leave-from {
|
||||||
|
opacity: 100;
|
||||||
|
}
|
||||||
|
.modal-leave-to {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
const stack = useModalStack();
|
const stack = useModalStack();
|
||||||
|
|
||||||
|
|||||||
@ -1,48 +1,23 @@
|
|||||||
<template>
|
<template>
|
||||||
<TransitionRoot
|
<div class="relative z-50" @close="emit('event', 'close')">
|
||||||
as="template"
|
|
||||||
:show="true"
|
|
||||||
:style="{ 'z-index': props.zHeight }"
|
|
||||||
>
|
|
||||||
<Dialog class="relative z-50" @close="emit('event', 'close')">
|
|
||||||
<TransitionChild
|
|
||||||
as="template"
|
|
||||||
enter="ease-out duration-300"
|
|
||||||
enter-from="opacity-0"
|
|
||||||
enter-to="opacity-100"
|
|
||||||
leave="ease-in duration-200"
|
|
||||||
leave-from="opacity-100"
|
|
||||||
leave-to="opacity-0"
|
|
||||||
>
|
|
||||||
<div
|
<div
|
||||||
class="fixed inset-0 bg-zinc-950 bg-opacity-75 transition-opacity"
|
class="fixed inset-0 bg-zinc-950/75"
|
||||||
/>
|
/>
|
||||||
</TransitionChild>
|
|
||||||
|
|
||||||
<div class="fixed inset-0 z-10 w-screen overflow-y-auto">
|
<div class="fixed inset-0 z-10 w-screen overflow-y-auto">
|
||||||
<div
|
<div
|
||||||
class="flex min-h-full items-start justify-center p-4 text-center sm:items-center sm:p-0"
|
class="flex min-h-full items-start justify-center p-4 text-center sm:items-center sm:p-0"
|
||||||
>
|
>
|
||||||
<TransitionChild
|
|
||||||
as="template"
|
|
||||||
enter="ease-out duration-300"
|
|
||||||
enter-from="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
|
|
||||||
enter-to="opacity-100 translate-y-0 sm:scale-100"
|
|
||||||
leave="ease-in duration-200"
|
|
||||||
leave-from="opacity-100 translate-y-0 sm:scale-100"
|
|
||||||
leave-to="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
|
|
||||||
>
|
|
||||||
<div
|
<div
|
||||||
class="relative transform rounded-lg bg-zinc-900 text-left shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-lg"
|
class="relative transform rounded-lg bg-zinc-900 text-left shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-lg"
|
||||||
>
|
>
|
||||||
<div class="px-4 pb-4 pt-5 space-y-4 sm:p-6 sm:pb-4">
|
<div class="px-4 pb-4 pt-5 space-y-4 sm:p-6 sm:pb-4">
|
||||||
<div class="sm:flex sm:items-start">
|
<div class="sm:flex sm:items-start">
|
||||||
<div class="mt-3 text-center sm:mt-0 sm:text-left">
|
<div class="mt-3 text-center sm:mt-0 sm:text-left">
|
||||||
<DialogTitle
|
<h3
|
||||||
as="h3"
|
|
||||||
class="text-base font-semibold text-zinc-100"
|
class="text-base font-semibold text-zinc-100"
|
||||||
>{{ props.data.title }}
|
>{{ props.data.title }}
|
||||||
</DialogTitle>
|
</h3>
|
||||||
<div class="mt-2">
|
<div class="mt-2">
|
||||||
<p class="text-sm text-zinc-400">
|
<p class="text-sm text-zinc-400">
|
||||||
{{ props.data.description }}
|
{{ props.data.description }}
|
||||||
@ -64,11 +39,9 @@
|
|||||||
</LoadingButton>
|
</LoadingButton>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</TransitionChild>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Dialog>
|
</div>
|
||||||
</TransitionRoot>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
|||||||
@ -1,91 +1,64 @@
|
|||||||
<template>
|
<template>
|
||||||
<TransitionRoot
|
<div class="relative z-50" @close="emit('event', 'cancel')">
|
||||||
as="template"
|
<div class="fixed inset-0 bg-zinc-950/75" />
|
||||||
:show="true"
|
|
||||||
:style="{ 'z-index': props.zHeight }"
|
<div class="fixed inset-0 z-10 w-screen overflow-y-auto">
|
||||||
>
|
<div
|
||||||
<Dialog class="relative z-50" @close="emit('event', 'cancel')">
|
class="flex min-h-full items-start justify-center p-4 text-center sm:items-center sm:p-0"
|
||||||
<TransitionChild
|
|
||||||
as="template"
|
|
||||||
enter="ease-out duration-300"
|
|
||||||
enter-from="opacity-0"
|
|
||||||
enter-to="opacity-100"
|
|
||||||
leave="ease-in duration-200"
|
|
||||||
leave-from="opacity-100"
|
|
||||||
leave-to="opacity-0"
|
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="fixed inset-0 bg-zinc-950 bg-opacity-75 transition-opacity"
|
class="relative transform rounded-lg bg-zinc-900 text-left shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-lg"
|
||||||
/>
|
|
||||||
</TransitionChild>
|
|
||||||
|
|
||||||
<div class="fixed inset-0 z-10 w-screen overflow-y-auto">
|
|
||||||
<div
|
|
||||||
class="flex min-h-full items-start justify-center p-4 text-center sm:items-center sm:p-0"
|
|
||||||
>
|
>
|
||||||
<TransitionChild
|
<div class="px-4 pb-4 pt-5 space-y-4 sm:p-6 sm:pb-4">
|
||||||
as="template"
|
<div class="sm:flex sm:items-start">
|
||||||
enter="ease-out duration-300"
|
<div class="mt-3 text-center sm:mt-0 sm:text-left w-full">
|
||||||
enter-from="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
|
<h3 class="text-base font-semibold text-zinc-100">
|
||||||
enter-to="opacity-100 translate-y-0 sm:scale-100"
|
{{ props.data.title }}
|
||||||
leave="ease-in duration-200"
|
</h3>
|
||||||
leave-from="opacity-100 translate-y-0 sm:scale-100"
|
<div class="mt-1">
|
||||||
leave-to="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
|
<p class="text-sm text-zinc-400">
|
||||||
>
|
{{ props.data.description }}
|
||||||
<div
|
</p>
|
||||||
class="relative transform rounded-lg bg-zinc-900 text-left shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-lg"
|
|
||||||
>
|
|
||||||
<div class="px-4 pb-4 pt-5 space-y-4 sm:p-6 sm:pb-4">
|
|
||||||
<div class="sm:flex sm:items-start">
|
|
||||||
<div class="mt-3 text-center sm:mt-0 sm:text-left">
|
|
||||||
<DialogTitle
|
|
||||||
as="h3"
|
|
||||||
class="text-base font-semibold text-zinc-100"
|
|
||||||
>{{ props.data.title }}
|
|
||||||
</DialogTitle>
|
|
||||||
<div class="mt-2">
|
|
||||||
<p class="text-sm text-zinc-400">
|
|
||||||
{{ props.data.description }}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<form @submit.prevent="() => emit('event', 'submit', v)">
|
|
||||||
<input
|
|
||||||
v-model="v"
|
|
||||||
type="text"
|
|
||||||
:placeholder="$t('library.collection.namePlaceholder')"
|
|
||||||
class="block w-full rounded-md border-0 bg-zinc-800 py-1.5 text-white shadow-sm ring-1 ring-inset ring-zinc-700 placeholder:text-zinc-400 focus:ring-2 focus:ring-inset focus:ring-blue-600 sm:text-sm sm:leading-6"
|
|
||||||
/>
|
|
||||||
<button class="hidden" type="submit" />
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<form
|
||||||
<div
|
class="mt-4 w-full"
|
||||||
class="rounded-b-lg bg-zinc-800 px-4 py-3 sm:flex sm:gap-x-2 sm:flex-row-reverse sm:px-6"
|
@submit.prevent="() => emit('event', 'submit', v)"
|
||||||
>
|
|
||||||
<LoadingButton
|
|
||||||
:loading="props.loading"
|
|
||||||
@click="emit('event', 'submit', v)"
|
|
||||||
type="submit"
|
|
||||||
class="w-full sm:w-fit"
|
|
||||||
>
|
>
|
||||||
{{ props.data.buttonText ?? "Confirm" }}
|
<input
|
||||||
</LoadingButton>
|
v-model="v"
|
||||||
<button
|
type="text"
|
||||||
type="button"
|
:placeholder="props.data.placeholder"
|
||||||
class="mt-3 inline-flex w-full justify-center rounded-md bg-zinc-800 px-3 py-2 text-sm font-semibold text-zinc-100 shadow-sm ring-1 ring-inset ring-zinc-700 hover:bg-zinc-900 sm:mt-0 sm:w-auto"
|
class="block w-full rounded-md border-0 bg-zinc-800 py-1.5 text-white shadow-sm ring-1 ring-inset ring-zinc-700 placeholder:text-zinc-400 focus:ring-2 focus:ring-inset focus:ring-blue-600 sm:text-sm sm:leading-6"
|
||||||
@click="emit('event', 'cancel')"
|
/>
|
||||||
ref="cancelButtonRef"
|
<button class="hidden" type="submit" />
|
||||||
>
|
</form>
|
||||||
Cancel
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</TransitionChild>
|
</div>
|
||||||
|
<div
|
||||||
|
class="rounded-b-lg bg-zinc-800 px-4 py-3 sm:flex sm:gap-x-2 sm:flex-row-reverse sm:px-6"
|
||||||
|
>
|
||||||
|
<LoadingButton
|
||||||
|
:loading="props.loading"
|
||||||
|
@click="emit('event', 'submit', v)"
|
||||||
|
type="submit"
|
||||||
|
class="w-full sm:w-fit"
|
||||||
|
>
|
||||||
|
{{ props.data.buttonText ?? "Submit" }}
|
||||||
|
</LoadingButton>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="mt-3 inline-flex w-full justify-center rounded-md bg-zinc-800 px-3 py-2 text-sm font-semibold text-zinc-100 shadow-sm ring-1 ring-inset ring-zinc-700 hover:bg-zinc-900 sm:mt-0 sm:w-auto"
|
||||||
|
@click="emit('event', 'cancel')"
|
||||||
|
ref="cancelButtonRef"
|
||||||
|
>
|
||||||
|
Cancel
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Dialog>
|
</div>
|
||||||
</TransitionRoot>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
|||||||
Reference in New Issue
Block a user