-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9463c58
commit 23c13c3
Showing
5 changed files
with
65 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
{ | ||
"cSpell.words": [ | ||
"Arctos", | ||
"Calvera" | ||
"Calvera", | ||
"failuires", | ||
"Interactable" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<script lang="ts"> | ||
import { onDestroy, onMount } from "svelte"; | ||
export let content: string; | ||
let tooltipVisible = false; | ||
let tooltipElement: HTMLSpanElement; | ||
let tooltipButton: HTMLButtonElement; | ||
// Handle clicks outside the tooltip | ||
const onClick = (event: MouseEvent) => { | ||
if (tooltipElement && tooltipButton && !(tooltipElement.contains(event.target as Node) || tooltipButton.contains(event.target as Node))) { | ||
tooltipVisible = false; | ||
} | ||
} | ||
onMount(() => { | ||
document.addEventListener("click", onClick); | ||
}); | ||
onDestroy(() => { | ||
document.removeEventListener("click", onClick); | ||
}); | ||
</script> | ||
|
||
<span class="relative"> | ||
<!-- Tooltip button --> | ||
<button bind:this={tooltipButton} class="clickable bg-primary rounded-full italic text-sm w-6 h-6 text-center" on:click={() => tooltipVisible = !tooltipVisible}>i</button> | ||
|
||
<!-- Tooltip --> | ||
<span | ||
bind:this={tooltipElement} | ||
class="absolute z-10 text-base bg-primary p-3 rounded-lg drop-shadow-btn-hover left-full right-[max(-50vw,-300px)] max-w-max transition-all opacity-0 translate-y-5 invisible" | ||
class:!visible={tooltipVisible} | ||
class:opacity-100={tooltipVisible} | ||
class:!translate-y-0={tooltipVisible} | ||
> | ||
{content} | ||
</span> | ||
</span> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters