feat(ui): give tooltips padding from screen edge

We can pass a popperjs modifier to the tooltip to give it this padding.
This commit is contained in:
psychedelicious 2024-01-04 19:03:57 +11:00 committed by Kent Keirsey
parent 01bab58b20
commit 8db14911d7

View File

@ -3,6 +3,15 @@ import { memo } from 'react';
import type { InvTooltipProps } from './types';
const modifiers: InvTooltipProps['modifiers'] = [
{
name: 'preventOverflow',
options: {
padding: 12,
},
},
];
export const InvTooltip = memo(
forwardRef<InvTooltipProps, typeof ChakraTooltip>(
(props: InvTooltipProps, ref) => {
@ -13,6 +22,7 @@ export const InvTooltip = memo(
hasArrow={hasArrow}
placement={placement}
arrowSize={8}
modifiers={modifiers}
{...rest}
>
{children}