improve tooltip positioning

This commit is contained in:
Vyacheslav Matyukhin 2022-07-26 21:55:38 +04:00
parent 2abb3968dd
commit 8be3f91d8e
No known key found for this signature in database
GPG Key ID: 3D2A774C5489F96C

View File

@ -1,6 +1,7 @@
import React, { cloneElement, useState } from "react"; import React, { cloneElement, useState } from "react";
import { AnimatePresence, motion } from "framer-motion"; import { AnimatePresence, motion } from "framer-motion";
import { import {
flip,
shift, shift,
useDismiss, useDismiss,
useFloating, useFloating,
@ -21,7 +22,7 @@ export const Tooltip: React.FC<Props> = ({ text, children }) => {
placement: "top", placement: "top",
open: isOpen, open: isOpen,
onOpenChange: setIsOpen, onOpenChange: setIsOpen,
middleware: [shift()], middleware: [shift(), flip()],
}); });
const { getReferenceProps, getFloatingProps } = useInteractions([ const { getReferenceProps, getFloatingProps } = useInteractions([