fix: center tooltip text

This commit is contained in:
Rotimi Best
2025-08-27 22:21:03 +01:00
committed by GitHub
parent 1c2760fd50
commit 7dfabf6e7f
@@ -10,10 +10,10 @@
class="tooltiptext z-20 {direction === 'right' class="tooltiptext z-20 {direction === 'right'
? 'right' ? 'right'
: direction === 'top' : direction === 'top'
? 'top' ? 'top'
: direction === 'bottom' : direction === 'bottom'
? 'bottom' ? 'bottom'
: 'left'}" : 'left'}"
> >
{title} {title}
{#if Array.isArray(hotkeys) && hotkeys.length} {#if Array.isArray(hotkeys) && hotkeys.length}
@@ -33,39 +33,50 @@
position: relative; position: relative;
display: inline-block; display: inline-block;
} }
.right { .top {
left: 100%; bottom: 100%;
right: unset !important; left: 50%;
}
.bottom {
bottom: -75% !important;
left: -80%;
right: unset !important; right: unset !important;
top: unset !important; top: unset !important;
transform: translateX(-50%);
margin-bottom: 5px;
}
.right {
left: 100%;
top: 50%;
right: unset !important;
bottom: unset !important;
transform: translateY(-50%);
margin-left: 5px;
}
.bottom {
top: 100%;
left: 50%;
right: unset !important;
bottom: unset !important;
transform: translateX(-50%);
margin-top: 5px;
}
.left {
right: 100%;
top: 50%;
left: unset !important;
bottom: unset !important;
transform: translateY(-50%);
margin-right: 5px;
} }
.tooltip .tooltiptext { .tooltip .tooltiptext {
color: #fff; color: #fff;
padding: 8px; padding: 10px 8px;
font-size: 0.625rem; font-size: 12px;
font-family: 'Roboto', 'Helvetica', 'Arial', sans-serif; font-family: 'Roboto', 'Helvetica', 'Arial', sans-serif;
font-weight: 500; line-height: 1.2em;
line-height: 1.4em;
border-radius: 8px;
background-color: #000; background-color: #000;
visibility: hidden; visibility: hidden;
text-align: center; text-align: center;
font-weight: bold;
white-space: nowrap; white-space: nowrap;
font-size: 13px;
/* Position the tooltip */
position: absolute; position: absolute;
z-index: 2; z-index: 2;
/* top: 100%;
left: 0; */
top: 20%;
right: 100%;
margin-left: 5px;
} }
.tooltip:hover .tooltiptext { .tooltip:hover .tooltiptext {