Skip to content

Commit

Permalink
fix(odyssey-storybook): stories were broken because templates don't h…
Browse files Browse the repository at this point in the history
…ave .args
  • Loading branch information
KevinGhadyani-Okta committed May 4, 2023
1 parent 7561823 commit 7f7343a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ const storybookMeta: Meta<InfoboxProps> = {
argTypes: {
children: {
control: "text",
defaultValue:
"You are currently logged in from Moonbase Alpha-6, located on Luna.",
},
role: {
control: "radio",
Expand Down Expand Up @@ -59,11 +61,6 @@ const DefaultTemplate: Story<InfoboxProps> = (args) => {
);
};

DefaultTemplate.args = {
children:
"You are currently logged in from Moonbase Alpha-6, located on Luna.",
};

export const Info = DefaultTemplate.bind({});
Info.args = {
children: "You're signed in from Moonbase Alpha-6, located on Luna.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ const storybookMeta: Meta<MenuButtonProps> = {
},
buttonLabel: {
control: "text",
defaultValue: "More actions",
},
buttonEndIcon: {
control: "text",
Expand All @@ -59,13 +60,8 @@ const DefaultTemplate: Story<MenuButtonProps> = (args) => {
return <MenuButton {...args}>{args.children}</MenuButton>;
};

DefaultTemplate.args = {
buttonLabel: "More actions",
};

export const Simple = DefaultTemplate.bind({});
Simple.args = {
buttonLabel: "More actions",
children: [
<MenuItem>View details</MenuItem>,
<MenuItem>Edit configuration</MenuItem>,
Expand Down Expand Up @@ -99,7 +95,6 @@ ActionIcons.args = {

export const ButtonVariant = DefaultTemplate.bind({});
ButtonVariant.args = {
buttonLabel: "More actions",
buttonVariant: "floating",
children: [
<MenuItem>View details</MenuItem>,
Expand All @@ -110,7 +105,6 @@ ButtonVariant.args = {

export const Groupings = DefaultTemplate.bind({});
Groupings.args = {
buttonLabel: "More actions",
children: [
<ListSubheader>Crew</ListSubheader>,
<MenuItem>Assign captain</MenuItem>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const storybookMeta: Meta<SearchFieldProps> = {
argTypes: {
autoCompleteType: {
control: "text",
defaultValue: "name",
},
hasInitialFocus: {
control: "boolean",
Expand All @@ -39,6 +40,7 @@ const storybookMeta: Meta<SearchFieldProps> = {
},
label: {
control: "text",
defaultValue: "Search",
},
onBlur: {
control: "function",
Expand All @@ -51,6 +53,7 @@ const storybookMeta: Meta<SearchFieldProps> = {
},
placeholder: {
control: "text",
defaultValue: "Search planets",
},
value: {
control: "text",
Expand All @@ -65,13 +68,4 @@ const Template: Story<SearchFieldProps> = (args) => {
return <SearchField {...args} />;
};

Template.args = {
autoCompleteType: "name",
label: "Destination",
};

export const Default = Template.bind({});
Default.args = {
label: "Search",
placeholder: "Search planets",
};
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,12 @@ const storybookMeta: Meta<ToastProps> = {
},
severity: {
control: "radio",
defaultValue: "info",
options: ["error", "info", "success", "warning"],
},
text: {
control: "text",
defaultValue: "The mission to Sagittarius A is set for January 7.",
},
},
decorators: [MuiThemeDecorator],
Expand Down Expand Up @@ -86,24 +88,10 @@ const DefaultTemplate: Story<ToastProps> = (args) => {
);
};

DefaultTemplate.args = {
severity: "info",
text: "The mission to Sagittarius A is set for January 7.",
};

const StaticTemplate: Story<ToastProps> = (args) => {
return <Toast {...args}></Toast>;
};

StaticTemplate.args = {
isVisible: true,
};

StaticTemplate.args = {
severity: "info",
text: "The mission to Sagittarius A is set for January 7.",
};

const MultipleTemplate: Story<ToastProps> = () => {
const [toasts, setToasts] = useState([
<Toast
Expand Down Expand Up @@ -160,7 +148,7 @@ export const Info = DefaultTemplate.bind({});
Info.args = {};

export const InfoStatic = StaticTemplate.bind({});
InfoStatic.args = {};
InfoStatic.args = { isVisible: true };

export const Error = DefaultTemplate.bind({});
Error.args = {
Expand All @@ -171,6 +159,7 @@ Error.args = {

export const ErrorStatic = StaticTemplate.bind({});
ErrorStatic.args = {
isVisible: true,
text: "Security breach in Hangar 18",
role: "alert",
severity: "error",
Expand All @@ -185,6 +174,7 @@ Warning.args = {

export const WarningStatic = StaticTemplate.bind({});
WarningStatic.args = {
isVisible: true,
text: "Severe solar winds may delay local system flights",
role: "status",
severity: "warning",
Expand All @@ -199,6 +189,7 @@ Success.args = {

export const SuccessStatic = StaticTemplate.bind({});
SuccessStatic.args = {
isVisible: true,
text: "Docking completed",
role: "status",
severity: "success",
Expand All @@ -214,6 +205,7 @@ Dismissible.args = {
export const DismissibleStatic = StaticTemplate.bind({});
DismissibleStatic.args = {
isDismissable: true,
isVisible: true,
linkText: "View report",
linkUrl: "#",
};
Expand Down

0 comments on commit 7f7343a

Please sign in to comment.