-
Notifications
You must be signed in to change notification settings - Fork 4
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
ea19b9f
commit f70fe99
Showing
12 changed files
with
84 additions
and
85 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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 +1 @@ | ||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><meta name="theme-color" content="#000000"><link rel="icon" href="data:,"><title>Final Fantasy 12 Character Planner</title><link rel="stylesheet" href="index.928c49fb.css"><script defer type="module" src="index.203c95b7.js"></script></head><body></body></html> | ||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><meta name="theme-color" content="#000000"><link rel="icon" href="data:,"><title>Final Fantasy 12 Character Planner</title><link rel="stylesheet" href="index.1445ecdb.css"><script defer type="module" src="index.9c03c1ec.js"></script></head><body></body></html> |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -9,4 +9,8 @@ | |
border-radius: 6px; | ||
background-color: rgba(0, 0, 0, 0.7); | ||
pointer-events: none; | ||
|
||
&.hidden { | ||
display: none; | ||
} | ||
} |
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,35 @@ | ||
import { computePosition, shift, flip } from "@floating-ui/dom"; | ||
import { TPC, effect, h, scheduleUpdate } from "vdomk"; | ||
import "./MouseOver.css"; | ||
|
||
const Tooltip: TPC<{}> = (_, instance) => { | ||
let floatingElement: HTMLDivElement | null = null; | ||
const ref = (value: HTMLDivElement | null) => floatingElement = value; | ||
|
||
let labelText: string | null = null; | ||
let referenceElement: Element | null = null; | ||
|
||
document.addEventListener("mouseover", event => { | ||
referenceElement = event.target as Element | null; | ||
while (referenceElement && (labelText = referenceElement.getAttribute("aria-label")) == null) { | ||
referenceElement = referenceElement.parentElement; | ||
} | ||
scheduleUpdate(instance); | ||
}, { passive: true }); | ||
|
||
async function updateStyles() { | ||
if (referenceElement && floatingElement) { | ||
const styles = await computePosition(referenceElement, floatingElement, { middleware: [flip(), shift()] }); | ||
floatingElement.style.transform = `translate(${Math.round(styles.x)}px,${Math.round(styles.y)}px)`; | ||
} | ||
} | ||
|
||
document.addEventListener("scroll", updateStyles, { passive: true, capture: true }); | ||
|
||
return () => { | ||
effect(instance, updateStyles); | ||
return <div ref={ref} class={labelText ? "tooltip" : "tooltip hidden"}>{labelText}</div>; | ||
}; | ||
}; | ||
|
||
export default Tooltip; |
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