mirror of
https://github.com/remvze/moodist.git
synced 2025-10-20 05:20:30 -04:00
refactor: better tooltip
This commit is contained in:
parent
f5cdb8c06b
commit
5fecd383aa
@ -28,6 +28,8 @@ export function UnselectButton() {
|
|||||||
variants={variants}
|
variants={variants}
|
||||||
>
|
>
|
||||||
<Tooltip
|
<Tooltip
|
||||||
|
hideDelay={0}
|
||||||
|
showDelay={0}
|
||||||
content={
|
content={
|
||||||
hasHistory
|
hasHistory
|
||||||
? 'Restore unselected sounds.'
|
? 'Restore unselected sounds.'
|
||||||
|
@ -38,9 +38,6 @@ export function Tooltip({
|
|||||||
floatingStyles,
|
floatingStyles,
|
||||||
placement: computedPlacement,
|
placement: computedPlacement,
|
||||||
refs,
|
refs,
|
||||||
strategy,
|
|
||||||
x,
|
|
||||||
y,
|
|
||||||
} = useFloating({
|
} = useFloating({
|
||||||
middleware: [offset(12), flip(), shift()],
|
middleware: [offset(12), flip(), shift()],
|
||||||
onOpenChange: setIsTooltipOpen,
|
onOpenChange: setIsTooltipOpen,
|
||||||
@ -90,20 +87,20 @@ export function Tooltip({
|
|||||||
|
|
||||||
<AnimatePresence>
|
<AnimatePresence>
|
||||||
{isTooltipOpen && (
|
{isTooltipOpen && (
|
||||||
|
<div
|
||||||
|
ref={refs.setFloating}
|
||||||
|
{...getFloatingProps({ style: floatingStyles })}
|
||||||
|
>
|
||||||
<motion.div
|
<motion.div
|
||||||
animate="show"
|
animate="show"
|
||||||
|
className={styles.tooltip}
|
||||||
exit="hidden"
|
exit="hidden"
|
||||||
initial="hidden"
|
initial="hidden"
|
||||||
ref={refs.setFloating}
|
|
||||||
style={floatingStyles}
|
|
||||||
variants={variants}
|
variants={variants}
|
||||||
{...getFloatingProps({
|
|
||||||
className: styles.tooltip,
|
|
||||||
style: { left: x ?? 0, position: strategy, top: y ?? 0 },
|
|
||||||
})}
|
|
||||||
>
|
>
|
||||||
{content}
|
{content}
|
||||||
</motion.div>
|
</motion.div>
|
||||||
|
</div>
|
||||||
)}
|
)}
|
||||||
</AnimatePresence>
|
</AnimatePresence>
|
||||||
</>
|
</>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user