@setoelkahfi / svara / commits / 6a7387c

fix: resolved error when there is no buttons to render

mellbacon committed May 21, 2024 at 18:25 UTC 6a7387ccc1ce0dfd03ce579e26b9b659fdefa9b1
1 file changed +6 -4
src/lib/ToolView.svelte
+6 -4
@@ -6,11 +6,12 @@
6 export let content = null;
7 export let name = "Tool";
8 export let options = [];
9 - export let buttons;
9 + export let buttons = [];
10 </script>
11 <div id="toolview">
12 <div class="header">{name}
13 <div class="header-tools">
14 + {#if buttons}
15 <div class="tool-buttons">
16 {#each buttons as button}
17 <!-- svelte-ignore a11y-click-events-have-key-events -->
@@ -18,10 +19,11 @@
19 <svelte:component this={button.icon}></svelte:component>
20 </div>
21 {/each}
21 - {#if options}
22 - <Menu right menu={{icon: Ellipsis, children: options}}></Menu>
23 - {/if}
22 </div>
23 + {/if}
24 + {#if options}
25 + <Menu right menu={{icon: Ellipsis, children: options}}></Menu>
26 + {/if}
27 <!-- svelte-ignore a11y-click-events-have-key-events -->
28 <span class="close" title="Hide Panel" on:click={hideBottomPanel}></span>
29 </div>