From c667dc927d1a65c5b901eb8b0f082f44a18c4291 Mon Sep 17 00:00:00 2001 From: Julie Wongbandue Date: Wed, 9 Aug 2023 14:23:22 -0400 Subject: [PATCH] Update with stickersheet and ignore hover styles when toggle is disabled --- src/components/inputs/Input/Input.style.ts | 4 +- src/components/inputs/Toggle/Toggle.story.tsx | 40 ++++++++++++++++--- 2 files changed, 37 insertions(+), 7 deletions(-) diff --git a/src/components/inputs/Input/Input.style.ts b/src/components/inputs/Input/Input.style.ts index 936d52bc5..36f1dc3fc 100755 --- a/src/components/inputs/Input/Input.style.ts +++ b/src/components/inputs/Input/Input.style.ts @@ -107,11 +107,11 @@ function fauxToggleChecked({ toggle, theme }) { } } - :hover:checked ~ ${Faux} { + :hover:checked:not(:disabled) ~ ${Faux} { background: ${darken(0.1, checkedColor)}; border-color: ${darken(0.1, checkedColor)}; } - :hover ~ ${Faux} { + :hover:not(:disabled) ~ ${Faux} { background: ${darken(0.1, unCheckedColor)}; border-color: transparent; } diff --git a/src/components/inputs/Toggle/Toggle.story.tsx b/src/components/inputs/Toggle/Toggle.story.tsx index 4d47bf149..454fff941 100755 --- a/src/components/inputs/Toggle/Toggle.story.tsx +++ b/src/components/inputs/Toggle/Toggle.story.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { Story } from '@storybook/react'; +import { StoryFn } from '@storybook/react'; import { Toggle, Props } from './Toggle'; @@ -10,17 +10,17 @@ export default { title: 'components/Toggle', component: Toggle, argTypes: { - status: { table: { disable: true } }, messages: { table: { disable: true } }, src: { table: { disable: true } }, - label: { control: { disable: true } }, + label: { control: { type: null } }, icon: { - control: { disable: true }, + control: { type: null }, }, + onKeyPress: { control: { type: null } }, }, }; -const Template: Story = (args) => { +const Template: StoryFn = (args) => { return ( @@ -35,3 +35,33 @@ const Template: Story = (args) => { }; export const Controls = Template.bind({}); Controls.storyName = 'Toggle'; + +const statuses = ['default', 'positive', 'negative']; +const disabled = [true, false]; +const stickers = [true, false].flatMap((checked) => + disabled.flatMap((disable) => + statuses.flatMap((status) => ({ + disabled: disable, + checked, + status, + })) + ) +); +console.log(stickers); +export const StickerSheet = () => { + return ( + <> + {stickers.map((sticker, i) => ( + + ))} + + ); +};