Skip to content

Commit bf4f4de

Browse files
committed
fix(empty-state): add content check to prevent empty tooltips from appearing.
1 parent 23acbf2 commit bf4f4de

File tree

4 files changed

+31
-23
lines changed

4 files changed

+31
-23
lines changed

docs/package-lock.json

Lines changed: 11 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@svelte-plugins/tooltips",
3-
"version": "0.1.6",
3+
"version": "0.1.7",
44
"license": "MIT",
55
"description": "A simple tooltip action and component designed for Svelte.",
66
"author": "Kieran Boyle (https://github.com/dysfunc)",

src/tooltip.svelte

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -89,20 +89,24 @@
8989
$: isComponent = typeof content === 'object';
9090
</script>
9191

92-
<span bind:this={containerRef} class="tooltip-container">
92+
{#if content}
93+
<span bind:this={containerRef} class="tooltip-container">
94+
<slot />
95+
<div
96+
bind:this={tooltipRef}
97+
class="tooltip animation-{animationEffect} {position} {theme}"
98+
class:arrowless={!arrow}
99+
class:show
100+
style="min-width: {minWidth}px; max-width: {maxWidth}px; text-align: {align};"
101+
>
102+
{#if !isComponent}
103+
{@html content}
104+
{/if}
105+
</div>
106+
</span>
107+
{:else}
93108
<slot />
94-
<div
95-
bind:this={tooltipRef}
96-
class="tooltip animation-{animationEffect} {position} {theme}"
97-
class:arrowless={!arrow}
98-
class:show
99-
style="min-width: {minWidth}px; max-width: {maxWidth}px; text-align: {align};"
100-
>
101-
{#if !isComponent}
102-
{@html content}
103-
{/if}
104-
</div>
105-
</span>
109+
{/if}
106110

107111
<style>
108112
/*--------------------------*

0 commit comments

Comments
 (0)