Add wrapper for TransitionChild
This commit is contained in:
20
src/lib/components/transitions/TransitionChildWrapper.svelte
Normal file
20
src/lib/components/transitions/TransitionChildWrapper.svelte
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import { hasOpenClosed } from "$lib/internal/open-closed";
|
||||||
|
import TransitionChild from "./TransitionChild.svelte";
|
||||||
|
import TransitionRoot, {
|
||||||
|
hasTransitionContext,
|
||||||
|
} from "./TransitionRoot.svelte";
|
||||||
|
|
||||||
|
let hasTransition = hasTransitionContext();
|
||||||
|
let hasOpen = hasOpenClosed();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{#if !hasTransition && hasOpen}
|
||||||
|
<TransitionRoot {...$$props}>
|
||||||
|
<slot />
|
||||||
|
</TransitionRoot>
|
||||||
|
{:else}
|
||||||
|
<TransitionChild {...$$props}>
|
||||||
|
<slot />
|
||||||
|
</TransitionChild>
|
||||||
|
{/if}
|
||||||
Reference in New Issue
Block a user