Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deprecated storybook args #1864

Merged
merged 2 commits into from
Jun 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 15 additions & 21 deletions packages/design-system/src/components/button.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,25 +116,19 @@ export const Button = ({
);

Button.argTypes = {
children: { defaultValue: "Button", control: "text" },
kof marked this conversation as resolved.
Show resolved Hide resolved
color: {
defaultValue: "primary",
control: { type: "inline-radio", options: colors },
},
prefix: {
defaultValue: "undefined",
control: { type: "inline-radio", options: Object.keys(iconsMap) },
},
suffix: {
defaultValue: "undefined",
control: { type: "inline-radio", options: Object.keys(iconsMap) },
},
disabled: { defaultValue: false, control: "boolean" },
state: {
defaultValue: "auto",
control: {
type: "inline-radio",
options: states,
},
},
children: { control: "text" },
color: { control: "inline-radio", options: colors },
prefix: { control: "inline-radio", options: Object.keys(iconsMap) },
suffix: { control: "inline-radio", options: Object.keys(iconsMap) },
disabled: { control: "boolean" },
state: { control: "inline-radio", options: states },
};

Button.args = {
children: "Button",
color: "primary",
prefix: "undefined",
suffix: "undefined",
disabled: false,
state: "auto",
};
15 changes: 9 additions & 6 deletions packages/design-system/src/components/label.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,13 @@ const LabelStory: ComponentStory<typeof Label> = ({
export { LabelStory as Label };

LabelStory.argTypes = {
children: { defaultValue: "Label text", control: "text" },
color: {
defaultValue: "default",
control: { type: "inline-radio", options: colors },
},
disabled: { defaultValue: false, control: "boolean" },
children: { control: "text" },
color: { control: "inline-radio", options: colors },
disabled: { control: "boolean" },
};

LabelStory.args = {
children: "Label text",
color: "default",
disabled: false,
};
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,8 @@ export default {
},
argTypes: {
direction: {
control: { type: "select", options: ["horizontal", "vertical", "wrap"] },
control: "select",
options: ["horizontal", "vertical", "wrap"],
},
},
} as ComponentMeta<typeof SortableList>;
34 changes: 13 additions & 21 deletions packages/design-system/src/components/small-icon-button.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const Demo = ({
<StoryGrid horizontal key={variant}>
{states.map((state) => (
<SmallIconButton
key={state}
key={state ?? "undefined"}
title={`${variant} ${state}`}
icon={<TrashIcon />}
state={state}
Expand All @@ -50,7 +50,7 @@ export const Demo = ({
<StoryGrid horizontal key={variant}>
{states.map((state) => (
<SmallIconButton
key={state}
key={state ?? "undefined"}
title={`${variant} ${state}`}
icon={<TrashIcon />}
state={state}
Expand All @@ -66,25 +66,17 @@ export const Demo = ({
);

Demo.argTypes = {
icon: {
defaultValue: "<MenuIcon>",
control: { type: "inline-radio", options: Object.keys(iconsMap) },
},
variant: {
defaultValue: "normal",
control: { type: "inline-radio", options: smallIconButtonVariants },
},
state: {
defaultValue: undefined,
control: {
type: "inline-radio",
options: states,
},
},
focused: {
defaultValue: false,
control: { type: "boolean" },
},
icon: { control: "inline-radio", options: Object.keys(iconsMap) },
variant: { control: "inline-radio", options: smallIconButtonVariants },
state: { control: "inline-radio", options: states },
focused: { control: "boolean" },
};

Demo.args = {
icon: "<MenuIcon>",
variant: "normal",
state: undefined,
focused: false,
};

Demo.storyName = "Small Icon Button";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,22 +115,17 @@ export const Demo = ({
);

Demo.argTypes = {
variant: {
defaultValue: "normal",
control: { type: "inline-radio", options: smallToggleButtonVariants },
},
pressed: {
defaultValue: false,
control: { type: "boolean" },
},
disabled: {
defaultValue: false,
control: { type: "boolean" },
},
focused: {
defaultValue: false,
control: { type: "boolean" },
},
variant: { control: "inline-radio", options: smallToggleButtonVariants },
pressed: { control: "boolean" },
disabled: { control: "boolean" },
focused: { control: "boolean" },
};

Demo.args = {
variant: "normal",
pressed: false,
disabled: false,
focused: false,
};

Demo.storyName = "Small Toggle Button";
Expand Down
15 changes: 7 additions & 8 deletions packages/design-system/src/components/toggle-button.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,13 @@ export const Demo = ({
);

Demo.argTypes = {
variant: {
defaultValue: "default",
control: { type: "inline-radio", options: toggleButtonVariants },
},
disabled: {
defaultValue: false,
control: { type: "boolean" },
},
variant: { control: "inline-radio", options: toggleButtonVariants },
disabled: { control: "boolean" },
};

Demo.args = {
variant: "default",
disabled: false,
};

Demo.storyName = "Toggle Button";
Expand Down
12 changes: 3 additions & 9 deletions packages/design-system/src/components/toggle-group.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,9 @@ export const Demo = ({
);

Demo.argTypes = {
type: {
control: { type: "inline-radio", options: ["single", "multiple"] },
},
color: {
control: { type: "inline-radio", options: toggleGroupColors },
},
disabled: {
control: { type: "boolean" },
},
type: { control: "inline-radio", options: ["single", "multiple"] },
color: { control: "inline-radio", options: toggleGroupColors },
disabled: { control: "boolean" },
};

Demo.storyName = "Toggle Group";
Expand Down
8 changes: 4 additions & 4 deletions packages/icons/src/index.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ export default {
title: "All Icons",
component: Icons,
argTypes: {
testColor: {
name: "Test color",
defaultValue: false,
},
testColor: { control: "boolean", name: "Test color" },
},
args: {
testColor: false,
},
};