From 6a0c3ca2d2af7383440e285985558f5e52c8cbc8 Mon Sep 17 00:00:00 2001 From: Szymon Graczyk Date: Tue, 26 Jul 2022 12:35:39 +0200 Subject: [PATCH] #344 Handle Switch disabled state visually (#353) * Lock icon added for the disabled state, * Applied proper color tokens for `hover`, `enabled`, and `disabled` cases, * Changed naming convention as `enabled/disabled` was easy to be confused with `checked (on)/unchecked (off)`, * Added multiple stories representing the changes, * Used `--color-action-default-rgb` for `box-shadow` * Added `StoryDescriptor` component for wrapping components that require additional description --- .../.storybook/preview-head.html | 16 ++++-- .../src/components/Button/Button.stories.tsx | 10 ++-- .../FileUploadProgress.stories.tsx | 2 +- .../src/components/Loader/Loader.stories.tsx | 2 +- .../src/components/Search/Search.stories.tsx | 48 ++++++++---------- .../src/components/Switch/Switch.module.scss | 44 +++++++++++------ .../src/components/Switch/Switch.spec.tsx | 7 ++- .../src/components/Switch/Switch.stories.tsx | 49 +++++++++++++------ .../src/components/Switch/Switch.tsx | 32 ++++++++---- .../src/components/Tag/Tag.stories.tsx | 8 +-- .../UploadBar/UploadBar.stories.tsx | 4 +- .../stories/components/StoryDescriptor.tsx | 15 ++++++ 12 files changed, 149 insertions(+), 88 deletions(-) create mode 100644 packages/react-components/src/stories/components/StoryDescriptor.tsx diff --git a/packages/react-components/.storybook/preview-head.html b/packages/react-components/.storybook/preview-head.html index 219ad10b2..bf950f523 100644 --- a/packages/react-components/.storybook/preview-head.html +++ b/packages/react-components/.storybook/preview-head.html @@ -8,10 +8,20 @@ color: var(--content-default); } - .spacer { + .story-container { + margin-bottom: 10px; + } + + .story-title { + font-size: 14px; + font-weight: 600; + margin-bottom: 5px; + } + + .story-spacer { margin-bottom: 5px; } - .spacer > * + * { + .story-spacer > * + * { margin-left: 5px; } @@ -24,7 +34,7 @@ * { box-sizing: border-box; - font-family: "Source Sans Pro", -apple-system, BlinkMacSystemFont, Segoe UI, + font-family: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, Segoe UI, Helvetica Neue, Arial, sans-serif; -webkit-font-smoothing: antialiased; } diff --git a/packages/react-components/src/components/Button/Button.stories.tsx b/packages/react-components/src/components/Button/Button.stories.tsx index 485909cf7..54f4a8191 100644 --- a/packages/react-components/src/components/Button/Button.stories.tsx +++ b/packages/react-components/src/components/Button/Button.stories.tsx @@ -51,7 +51,7 @@ button.args = { export const kinds = (): React.ReactElement => (
-
+
@@ -65,7 +65,7 @@ export const kinds = (): React.ReactElement => ( export const states = (): React.ReactElement => (
-
+
-
+
@@ -123,7 +123,7 @@ export const sizes = (): React.ReactElement => ( Large
-
+