From c994f2d91bf13af15760f02ed83aa0e23b8a2d20 Mon Sep 17 00:00:00 2001 From: Arthur Green Date: Thu, 19 Oct 2023 02:12:03 +0400 Subject: [PATCH] fix(Button): role related styles (#21) --- src/components/button/Button.stories.ts | 11 ++---- src/components/button/Button.tsx | 17 ++++----- src/components/button/button.module.scss | 48 +++++++++++++----------- 3 files changed, 37 insertions(+), 39 deletions(-) diff --git a/src/components/button/Button.stories.ts b/src/components/button/Button.stories.ts index 2c28390..0194f86 100644 --- a/src/components/button/Button.stories.ts +++ b/src/components/button/Button.stories.ts @@ -12,10 +12,6 @@ const meta = { }, // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/react/writing-docs/autodocs tags: ['autodocs'], - // More on argTypes: https://storybook.js.org/docs/react/api/argtypes - argTypes: { - backgroundColor: { control: 'color' }, - }, } satisfies Meta; export default meta; @@ -49,10 +45,9 @@ export const Small: Story = { }, }; -export const Warning: Story = { +export const Disabled: Story = { args: { - primary: true, - label: 'Delete now', - backgroundColor: 'red', + label: 'Disabled button', + isDisabled: true, }, }; diff --git a/src/components/button/Button.tsx b/src/components/button/Button.tsx index 4ed9826..93d1c75 100644 --- a/src/components/button/Button.tsx +++ b/src/components/button/Button.tsx @@ -5,10 +5,6 @@ interface ButtonProps { * Is this the principal call to action on the page? */ primary?: boolean; - /** - * What background color to use - */ - backgroundColor?: string; /** * How large should the button be? */ @@ -17,6 +13,8 @@ interface ButtonProps { * Button contents */ label: string; + isDisabled?: boolean; + className?: string; /** * Optional click handler */ @@ -29,20 +27,19 @@ interface ButtonProps { export const Button = ({ primary = false, size = 'medium', - backgroundColor, label, + isDisabled, + className, ...props }: ButtonProps) => { - const mode = primary - ? 'storybook-button--primary' - : 'storybook-button--secondary'; + const mode = primary ? classes['btn--primary'] : classes['btn--secondary']; return (