From e97325a2c174a87c29593d1b42b9a1cc1eaf11af Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Wed, 4 Oct 2023 15:06:29 +0200 Subject: refactor(components): rewrite HelpButton component --- src/components/molecules/tooltip/tooltip.tsx | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'src/components/molecules/tooltip/tooltip.tsx') diff --git a/src/components/molecules/tooltip/tooltip.tsx b/src/components/molecules/tooltip/tooltip.tsx index 43ceced..1f54d68 100644 --- a/src/components/molecules/tooltip/tooltip.tsx +++ b/src/components/molecules/tooltip/tooltip.tsx @@ -1,8 +1,9 @@ -import { FC, MouseEventHandler, useRef } from 'react'; -import { Heading, Modal, ModalProps } from '../../atoms'; +import { type FC, type MouseEventHandler, useRef } from 'react'; +import { useIntl } from 'react-intl'; +import { useOnClickOutside } from '../../../utils/hooks'; +import { Heading, Icon, Modal, type ModalProps } from '../../atoms'; import { HelpButton } from '../buttons'; import styles from './tooltip.module.scss'; -import { useOnClickOutside } from '../../../utils/hooks'; export type TooltipProps = Omit & { /** @@ -47,6 +48,12 @@ export const Tooltip: FC = ({ onToggle, ...props }) => { + const intl = useIntl(); + const helpLabel = intl.formatMessage({ + defaultMessage: 'Show help', + description: 'Tooltip: show help label', + id: '1Xgg7+', + }); const directionModifier = direction === 'upwards' ? 'tooltip--up' : 'tooltip--down'; const visibilityModifier = isOpen ? 'tooltip--visible' : 'tooltip--hidden'; @@ -70,9 +77,7 @@ export const Tooltip: FC = ({ className={tooltipClass} heading={ - - ? - + {heading} } @@ -82,8 +87,9 @@ export const Tooltip: FC = ({ {children} -- cgit v1.2.3