diff options
| author | Armand Philippot <git@armandphilippot.com> | 2022-04-06 19:17:15 +0200 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2022-04-06 19:17:15 +0200 |
| commit | 51889773b12c576dc199fc84d0188f822ac7baae (patch) | |
| tree | d79897d463f2517573f6dfce2d1bd27ca476eb28 /src/components/molecules/buttons/help-button.tsx | |
| parent | 47e12259d512e476326e83929efebf036b57f7c1 (diff) | |
chore: add a HelpButton component
I also added a new shape to the button base.
Diffstat (limited to 'src/components/molecules/buttons/help-button.tsx')
| -rw-r--r-- | src/components/molecules/buttons/help-button.tsx | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/components/molecules/buttons/help-button.tsx b/src/components/molecules/buttons/help-button.tsx new file mode 100644 index 0000000..4945bb4 --- /dev/null +++ b/src/components/molecules/buttons/help-button.tsx @@ -0,0 +1,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; |
