From b214baab3e17d92f784b4f782863deafc5558ee4 Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Wed, 18 May 2022 14:27:11 +0200 Subject: chore: close toolbar modals on click/focus outside --- src/components/molecules/modals/tooltip.tsx | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'src/components/molecules/modals') diff --git a/src/components/molecules/modals/tooltip.tsx b/src/components/molecules/modals/tooltip.tsx index 80721f3..efb3009 100644 --- a/src/components/molecules/modals/tooltip.tsx +++ b/src/components/molecules/modals/tooltip.tsx @@ -1,5 +1,5 @@ import List, { type ListItem } from '@components/atoms/lists/list'; -import { FC, ReactNode } from 'react'; +import { forwardRef, ForwardRefRenderFunction, ReactNode } from 'react'; import styles from './tooltip.module.scss'; export type TooltipProps = { @@ -26,12 +26,10 @@ export type TooltipProps = { * * Render a tooltip modal. */ -const Tooltip: FC = ({ - className = '', - content, - icon, - title, -}) => { +const Tooltip: ForwardRefRenderFunction = ( + { className = '', content, icon, title }, + ref +) => { /** * Format an array of strings to an array of object with id and value. * @@ -45,7 +43,7 @@ const Tooltip: FC = ({ }; return ( -
+
{icon} {title} @@ -59,4 +57,4 @@ const Tooltip: FC = ({ ); }; -export default Tooltip; +export default forwardRef(Tooltip); -- cgit v1.2.3