From d7d453f7333def28007b94b9c9d872f89224fc91 Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Thu, 31 Mar 2022 14:25:12 +0200 Subject: chore: add a button component --- src/components/atoms/buttons/button.tsx | 53 +++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 src/components/atoms/buttons/button.tsx (limited to 'src/components/atoms/buttons/button.tsx') diff --git a/src/components/atoms/buttons/button.tsx b/src/components/atoms/buttons/button.tsx new file mode 100644 index 0000000..420ee74 --- /dev/null +++ b/src/components/atoms/buttons/button.tsx @@ -0,0 +1,53 @@ +import { FC, MouseEventHandler } from 'react'; +import styles from './buttons.module.scss'; + +export type ButtonProps = { + /** + * Button accessible label. + */ + 'aria-label'?: string; + /** + * Button state. Default: false. + */ + disabled?: boolean; + /** + * Button kind. Default: secondary. + */ + kind?: 'primary' | 'secondary' | 'tertiary'; + /** + * A callback function to handle click. + */ + onClick?: MouseEventHandler; + /** + * Button type attribute. Default: button. + */ + type?: 'button' | 'reset' | 'submit'; +}; + +/** + * Button component + * + * Use a button as call to action. + */ +const Button: FC = ({ + children, + disabled = false, + kind = 'secondary', + type = 'button', + ...props +}) => { + const kindClass = styles[`btn--${kind}`]; + + return ( + + ); +}; + +export default Button; -- cgit v1.2.3