Add tooltip to drag

This commit is contained in:
Aoife
2021-04-06 13:44:07 -04:00
parent 3d8b11c44c
commit a2976f4252
+10
View File
@@ -154,6 +154,14 @@ function Knob({
}, [onMouseMove]); }, [onMouseMove]);
return ( return (
<div className='flex flex-col items-center'>
{/* TOOLTIP */}
<div
className={` ${
isDragging ? 'opacity-100' : 'opacity-0'
} transition duration-75 ease-in select-none pointer-events-none absolute -mt-6 bg-gray-800 text-white truncate text-xs box-content rounded text-center w-8 py-0.5`}>
{Math.round(value * maxValue)}
</div>
<div <div
style={{ style={{
position: 'relative', position: 'relative',
@@ -164,6 +172,7 @@ function Knob({
flexShrink: 0, flexShrink: 0,
}} }}
onMouseDown={onMouseDown}> onMouseDown={onMouseDown}>
{/* KNOB */}
<svg className='absolute top-0 left-0' width={size} height={size}> <svg className='absolute top-0 left-0' width={size} height={size}>
<defs> <defs>
<DialMask <DialMask
@@ -239,6 +248,7 @@ function Knob({
</svg> </svg>
</svg> </svg>
</div> </div>
</div>
); );
} }
export { Select, Knob, Checkbox }; export { Select, Knob, Checkbox };