summaryrefslogtreecommitdiffstats
path: root/src/components/molecules/buttons/help-button.tsx
blob: 4945bb48fb5433e7d2e561c8cbb20887dd67c582 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import Button, { ButtonProps } from '@components/atoms/buttons/button';
import { FC } from 'react';
import { useIntl } from 'react-intl';
import styles from './help-button.module.scss';

export type HelpButtonProps = Pick<ButtonProps, 'onClick'>;

/**
 * HelpButton component
 *
 * Render a button with an interrogation mark icon.
 */
const HelpButton: FC<HelpButtonProps> = ({ onClick }) => {
  const intl = useIntl();
  const text = intl.formatMessage({
    defaultMessage: 'Help',
    id: 'i+/ckF',
    description: 'HelpButton: screen reader text',
  });

  return (
    <Button shape="circle" additionalClasses={styles.btn} onClick={onClick}>
      <span className="screen-reader-text">{text}</span>
      <span className={styles.icon}>?</span>
    </Button>
  );
};

export default HelpButton;