fix: tooltip overlaps a window border (#599)

This commit is contained in:
Tiefseemonster 2022-11-27 01:48:21 +01:00 committed by GitHub
parent dd7d322c47
commit 2fa01886da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 0 deletions

View File

@ -64,6 +64,11 @@ const UsageHeatMap = () => {
tempDiv.style.top = bounding.top - 2 + "px";
tempDiv.innerHTML = `${item.count} memos on <span className="date-text">${new Date(item.timestamp as number).toDateString()}</span>`;
document.body.appendChild(tempDiv);
if (tempDiv.offsetLeft - tempDiv.clientWidth / 2 < 0) {
tempDiv.style.left = bounding.left + tempDiv.clientWidth * 0.4 + "px";
tempDiv.className += " offset-left";
}
}, []);
const handleUsageStatItemMouseLeave = useCallback(() => {

View File

@ -54,6 +54,12 @@
@apply text-gray-300;
}
&.offset-left {
&::before {
left: calc(10% - 5px);
}
}
&::before {
content: "";
position: absolute;