From 51889773b12c576dc199fc84d0188f822ac7baae Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Wed, 6 Apr 2022 19:17:15 +0200 Subject: chore: add a HelpButton component I also added a new shape to the button base. --- src/components/atoms/buttons/button.stories.tsx | 2 +- src/components/atoms/buttons/button.tsx | 13 +++++++--- src/components/atoms/buttons/buttons.module.scss | 7 +++++- .../molecules/buttons/help-button.module.scss | 21 ++++++++++++++++ .../molecules/buttons/help-button.stories.tsx | 16 ++++++++++++ .../molecules/buttons/help-button.test.tsx | 9 +++++++ src/components/molecules/buttons/help-button.tsx | 29 ++++++++++++++++++++++ 7 files changed, 92 insertions(+), 5 deletions(-) create mode 100644 src/components/molecules/buttons/help-button.module.scss create mode 100644 src/components/molecules/buttons/help-button.stories.tsx create mode 100644 src/components/molecules/buttons/help-button.test.tsx create mode 100644 src/components/molecules/buttons/help-button.tsx (limited to 'src') diff --git a/src/components/atoms/buttons/button.stories.tsx b/src/components/atoms/buttons/button.stories.tsx index bec5e5d..9f4061b 100644 --- a/src/components/atoms/buttons/button.stories.tsx +++ b/src/components/atoms/buttons/button.stories.tsx @@ -80,7 +80,7 @@ export default { type: 'select', }, description: 'The link shape.', - options: ['rectangle', 'square'], + options: ['circle', 'rectangle', 'square'], table: { category: 'Options', defaultValue: { summary: 'rectangle' }, diff --git a/src/components/atoms/buttons/button.tsx b/src/components/atoms/buttons/button.tsx index 08b8d67..ae4c894 100644 --- a/src/components/atoms/buttons/button.tsx +++ b/src/components/atoms/buttons/button.tsx @@ -2,10 +2,14 @@ import { FC, MouseEventHandler } from 'react'; import styles from './buttons.module.scss'; export type ButtonProps = { + /** + * Add additional classes to the button wrapper. + */ + additionalClasses?: string; /** * Button accessible label. */ - 'aria-label'?: string; + ariaLabel?: string; /** * Button state. Default: false. */ @@ -21,7 +25,7 @@ export type ButtonProps = { /** * Button shape. Default: rectangle. */ - shape?: 'rectangle' | 'square'; + shape?: 'circle' | 'rectangle' | 'square'; /** * Button type attribute. Default: button. */ @@ -34,6 +38,8 @@ export type ButtonProps = { * Use a button as call to action. */ const Button: FC = ({ + additionalClasses, + ariaLabel, children, disabled = false, kind = 'secondary', @@ -48,7 +54,8 @@ const Button: FC = ({ + ); +}; + +export default HelpButton; -- cgit v1.2.3