mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix(tooltip): position could change from top to side
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { useState, ReactNode } from 'react';
|
||||
import { useFloating, autoUpdate, offset, flip, shift, useHover, useFocus, useDismiss, useRole, useInteractions, FloatingPortal } from '@floating-ui/react';
|
||||
import { useFloating, autoUpdate, offset, shift, useHover, useFocus, useDismiss, useRole, useInteractions, FloatingPortal } from '@floating-ui/react';
|
||||
import styles from './tooltip.module.css';
|
||||
|
||||
interface TooltipProps {
|
||||
@@ -16,13 +16,7 @@ const Tooltip = ({ content, children, showTooltip = true }: TooltipProps) => {
|
||||
onOpenChange: setIsOpen,
|
||||
placement: 'top',
|
||||
whileElementsMounted: autoUpdate,
|
||||
middleware: [
|
||||
offset(5),
|
||||
flip({
|
||||
fallbackAxisSideDirection: 'start',
|
||||
}),
|
||||
shift(),
|
||||
],
|
||||
middleware: [offset(5), shift()],
|
||||
});
|
||||
|
||||
const hover = useHover(context, { move: false, delay: { open: 500, close: 0 } });
|
||||
|
||||
Reference in New Issue
Block a user