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 --- .../molecules/buttons/help-button/help-button.tsx | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/components/molecules/buttons/help-button/help-button.tsx (limited to 'src/components/molecules/buttons/help-button/help-button.tsx') diff --git a/src/components/molecules/buttons/help-button/help-button.tsx b/src/components/molecules/buttons/help-button/help-button.tsx new file mode 100644 index 0000000..1951b4d --- /dev/null +++ b/src/components/molecules/buttons/help-button/help-button.tsx @@ -0,0 +1,42 @@ +import { forwardRef, type ForwardRefRenderFunction } from 'react'; +import { Button, VisuallyHidden, type ButtonProps, Icon } from '../../../atoms'; +import styles from './help-button.module.scss'; + +export type HelpButtonProps = Omit< + ButtonProps, + 'aria-label' | 'children' | 'kind' | 'shape' +> & { + /** + * Define an accessible name for the button. + */ + label: string; +}; + +const HelpButtonWithRef: ForwardRefRenderFunction< + HTMLButtonElement, + HelpButtonProps +> = ({ className = '', isPressed = false, label, ...props }, ref) => { + const btnClass = `${styles.btn} ${className}`; + + return ( + + ); +}; + +/** + * HelpButton component + * + * Render a button with an interrogation mark icon. + */ +export const HelpButton = forwardRef(HelpButtonWithRef); -- cgit v1.2.3