You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -20,14 +20,13 @@ Let's add a fade to our backdrop by adding `transition:fade`
20
20
21
21
```svelte
22
22
<script>
23
-
import { ModalStack } from 'svelte-modal-stack'
23
+
import { ModalStack, closeModal } from 'svelte-modal-stack'
24
24
import { fade } from 'svelte/transition'
25
25
</script>
26
26
27
27
<ModalStack>
28
28
<div
29
29
slot="backdrop"
30
-
let:closeModal
31
30
class="backdrop"
32
31
transition:fade
33
32
on:click={closeModal}
@@ -40,11 +39,9 @@ and let's do the same for the modal
40
39
41
40
```svelte
42
41
<script>
43
-
import { useModals } from 'svelte-modal-stack'
42
+
import { closeModal } from 'svelte-modal-stack'
44
43
import { fade } from 'svelte/transition'
45
44
46
-
const { closeModal } = useModals()
47
-
48
45
export let isOpen
49
46
export let title
50
47
export let message
@@ -64,29 +61,17 @@ and let's do the same for the modal
64
61
{/if}
65
62
```
66
63
67
-
<ModalStacklet:openModal>
68
-
<div
69
-
slot="backdrop"
70
-
let:closeModal
71
-
class="backdrop"
72
-
transition:fade
73
-
on:click={closeModal}
74
-
/>
75
-
<button
76
-
class="mt-6"
77
-
on:click={() => {
78
-
openModal(AnimatedAlertModal, { title: 'Alert', message: 'This is an alert' })
79
-
}}
80
-
>
81
-
Try it out
82
-
</button>
83
-
</ModalStack>
64
+
<button
65
+
class="mt-6"
66
+
on:click={() => {
67
+
openModal(AnimatedAlertModal, { title: 'Alert', message: 'This is an alert' })
68
+
}}> Try it out</button>
84
69
85
70
## Transitions between Modals
86
71
87
-
If you are opening one modal after another, the transitions will overlap. Sometimes this is desired, but most times probably not.
72
+
If you are opening one modal after another, the intro and outro transitions of both modals will overlap. Depending on your animation, this might be ok, but often it's cleaner to transition one at a time.
88
73
89
-
To change this, modals can transition one at a time as long as they forward the `on:introstart` and `on:outroend` events.
74
+
You can do this by forwarding the `on:introstart` and `on:outroend` events in your modal components.
90
75
91
76
```svelte
92
77
<script>
@@ -102,38 +87,14 @@ To change this, modals can transition one at a time as long as they forward the
0 commit comments