From 2f543b15848b58fa522921a52ccdd080adf7dba0 Mon Sep 17 00:00:00 2001 From: anatolzak <53095479+anatolzak@users.noreply.github.com> Date: Thu, 22 Feb 2024 17:29:08 +0200 Subject: [PATCH] standardize conditional rendering across components to prevent out transition bug during navigation huntabyte#340 --- .../components/accordion-content.svelte | 71 ++++++---- .../menu/components/menu-sub-content.svelte | 124 +++++++++--------- 2 files changed, 107 insertions(+), 88 deletions(-) diff --git a/src/lib/bits/accordion/components/accordion-content.svelte b/src/lib/bits/accordion/components/accordion-content.svelte index 4d714d085..87f4fbf8b 100644 --- a/src/lib/bits/accordion/components/accordion-content.svelte +++ b/src/lib/bits/accordion/components/accordion-content.svelte @@ -32,32 +32,49 @@ $: Object.assign(builder, attrs); -{#if asChild && $isSelected(props)} - -{:else if transition && $isSelected(props)} -
+{#if $isSelected(props)} + {#if asChild} -
-{:else if inTransition && outTransition && $isSelected(props)} -
- -
-{:else if inTransition && $isSelected(props)} -
- -
-{:else if outTransition && $isSelected(props)} -
- -
-{:else if $isSelected(props)} -
- -
+ {:else if transition} +
+ +
+ {:else if inTransition && outTransition} +
+ +
+ {:else if inTransition} +
+ +
+ {:else if outTransition} +
+ +
+ {:else} +
+ +
+ {/if} {/if} diff --git a/src/lib/bits/menu/components/menu-sub-content.svelte b/src/lib/bits/menu/components/menu-sub-content.svelte index 455318835..67d507b46 100644 --- a/src/lib/bits/menu/components/menu-sub-content.svelte +++ b/src/lib/bits/menu/components/menu-sub-content.svelte @@ -63,66 +63,68 @@ }); -{#if asChild && $subOpen} - -{:else if transition && $subOpen} -
+{#if $subOpen} + {#if asChild} -
-{:else if inTransition && outTransition && $subOpen} -
- -
-{:else if inTransition && $subOpen} -
- -
-{:else if outTransition && $subOpen} -
- -
-{:else if $subOpen} -
- -
+ {:else if transition} +
+ +
+ {:else if inTransition && outTransition} +
+ +
+ {:else if inTransition} +
+ +
+ {:else if outTransition} +
+ +
+ {:else} +
+ +
+ {/if} {/if}