pl-fe: Fix floating elements position

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak
2024-10-04 00:29:50 +02:00
parent 93e0311984
commit 3fdd22e900
7 changed files with 16 additions and 6 deletions

View File

@ -1,6 +1,7 @@
import {
arrow,
autoPlacement,
autoUpdate,
FloatingArrow,
offset,
shift,
@ -57,6 +58,7 @@ const Popover: React.FC<IPopover> = ({ children, content, referenceElementClassN
element: arrowRef,
}),
],
whileElementsMounted: autoUpdate,
});
const { isMounted, styles } = useTransitionStyles(context, {
@ -94,6 +96,7 @@ const Popover: React.FC<IPopover> = ({ children, content, referenceElementClassN
<Portal>
<div
ref={refs.setFloating}
className='z-40'
style={{
position: strategy,
top: y ?? 0,
@ -104,7 +107,7 @@ const Popover: React.FC<IPopover> = ({ children, content, referenceElementClassN
<div
className={
clsx(
'z-40 overflow-hidden rounded-lg bg-white shadow-2xl dark:bg-gray-900 dark:ring-2 dark:ring-primary-700',
'overflow-hidden rounded-lg bg-white shadow-2xl dark:bg-gray-900 dark:ring-2 dark:ring-primary-700',
{ 'p-6': !isFlush },
)
}

View File

@ -1,5 +1,6 @@
import {
arrow,
autoUpdate,
FloatingArrow,
FloatingPortal,
offset,
@ -39,6 +40,7 @@ const Tooltip: React.FC<ITooltip> = (props) => {
element: arrowRef,
}),
],
whileElementsMounted: autoUpdate,
});
const hover = useHover(context);