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 { 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';
|
import styles from './tooltip.module.css';
|
||||||
|
|
||||||
interface TooltipProps {
|
interface TooltipProps {
|
||||||
@@ -16,13 +16,7 @@ const Tooltip = ({ content, children, showTooltip = true }: TooltipProps) => {
|
|||||||
onOpenChange: setIsOpen,
|
onOpenChange: setIsOpen,
|
||||||
placement: 'top',
|
placement: 'top',
|
||||||
whileElementsMounted: autoUpdate,
|
whileElementsMounted: autoUpdate,
|
||||||
middleware: [
|
middleware: [offset(5), shift()],
|
||||||
offset(5),
|
|
||||||
flip({
|
|
||||||
fallbackAxisSideDirection: 'start',
|
|
||||||
}),
|
|
||||||
shift(),
|
|
||||||
],
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const hover = useHover(context, { move: false, delay: { open: 500, close: 0 } });
|
const hover = useHover(context, { move: false, delay: { open: 500, close: 0 } });
|
||||||
|
|||||||
Reference in New Issue
Block a user