From ea7b8b5036096af3d38741cd37dd84610c63908d Mon Sep 17 00:00:00 2001 From: David Ralph Date: Fri, 5 Jan 2024 12:13:20 +0000 Subject: [PATCH] fix: tooltips apart from notes due to floating-ui upgrade --- src/components/helpers/tooltip/Tooltip.jsx | 11 ++++++++--- src/components/helpers/tooltip/infoTooltip.jsx | 10 +++++++--- src/components/widgets/navbar/Notes.jsx | 14 ++++++++++---- src/components/widgets/navbar/Todo.jsx | 11 ++++++++--- 4 files changed, 33 insertions(+), 13 deletions(-) diff --git a/src/components/helpers/tooltip/Tooltip.jsx b/src/components/helpers/tooltip/Tooltip.jsx index 64b3a21c..57fe1709 100644 --- a/src/components/helpers/tooltip/Tooltip.jsx +++ b/src/components/helpers/tooltip/Tooltip.jsx @@ -5,9 +5,14 @@ import './tooltip.scss'; function Tooltip({ children, title, style, placement, subtitle }) { const [showTooltip, setShowTooltip] = useState(false); - const { x, y, reference, floating, strategy } = useFloating({ + const [reference, setReference] = useState(null); + + const { x, y, refs, strategy } = useFloating({ placement: placement || 'bottom', middleware: [flip(), offset(15), shift()], + elements: { + reference, + }, }); return ( @@ -19,13 +24,13 @@ function Tooltip({ children, title, style, placement, subtitle }) { onMouseLeave={() => setShowTooltip(false)} onFocus={() => setShowTooltip(true)} onBlur={() => setShowTooltip(false)} - ref={reference} + ref={setReference} > {children} {showTooltip && ( +
setShowTooltip(true)} /> {showTooltip && (
+ ); }