-
Notifications
You must be signed in to change notification settings - Fork 306
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate others components to CSF3 notation
- Loading branch information
Showing
9 changed files
with
111 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,28 @@ | ||
/* eslint-disable no-console */ | ||
// Status.stories.ts|tsx | ||
import { Meta } from "@storybook/react"; | ||
import Button from "./Button"; | ||
|
||
import { ComponentStory, ComponentMeta } from "@storybook/react"; | ||
import Button, { ButtonProps } from "./Button"; | ||
//👇 This default export determines where your story goes in the story list | ||
export default { | ||
const meta = { | ||
/* 👇 The title prop is optional. | ||
* See https://storybook.js.org/docs/react/configure/overview#configure-story-loading | ||
* to learn how to generate automatic titles | ||
*/ | ||
title: "Button", | ||
component: Button, | ||
} as ComponentMeta<typeof Button>; | ||
} satisfies Meta<typeof Button>; | ||
|
||
// Recall that Button has 'props' which is of type ButtonProps | ||
// We want to past theme to the story with the name 'Default', so we | ||
// create a template for it. | ||
// We want to declare default values for the props, so we create a | ||
// default args object. | ||
const Template: ComponentStory<typeof Button> = (args: ButtonProps) => ( | ||
<Button {...args} /> | ||
); | ||
export const Default = Template.bind({}); | ||
Default.args = { | ||
children: ( | ||
<> | ||
<span>↑</span> | ||
<span>Update</span> | ||
</> | ||
), | ||
onClick: () => { | ||
console.log("click"); | ||
export default meta; | ||
|
||
export const Default = { | ||
args: { | ||
children: ( | ||
<> | ||
<span>↑</span> | ||
<span>Update</span> | ||
</> | ||
), | ||
onClick: () => { | ||
console.log("click"); | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,20 @@ | ||
// TabsBar.stories.ts|tsx | ||
|
||
import { ComponentStory, ComponentMeta } from "@storybook/react"; | ||
import { StoryFn, Meta } from "@storybook/react"; | ||
import ShutDownButton from "./ShutDownButton"; | ||
|
||
//👇 This default export determines where your story goes in the story list | ||
export default { | ||
const meta = { | ||
/* 👇 The title prop is optional. | ||
* See https://storybook.js.org/docs/react/configure/overview#configure-story-loading | ||
* to learn how to generate automatic titles | ||
*/ | ||
title: "ShutDownButton", | ||
component: ShutDownButton, | ||
} as ComponentMeta<typeof ShutDownButton>; | ||
} satisfies Meta<typeof ShutDownButton>; | ||
|
||
export default meta; | ||
|
||
//👇 We create a “template” of how args map to rendering | ||
const Template: ComponentStory<typeof ShutDownButton> = () => ( | ||
<ShutDownButton /> | ||
); | ||
const Template: StoryFn<typeof ShutDownButton> = () => <ShutDownButton />; | ||
|
||
export const Default = Template.bind({}); | ||
export const Default = { | ||
render: Template, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,33 @@ | ||
// TabsBar.stories.ts|tsx | ||
|
||
import { ComponentStory, ComponentMeta } from "@storybook/react"; | ||
import { Meta } from "@storybook/react"; | ||
import TabsBar from "./TabsBar"; | ||
|
||
//👇 This default export determines where your story goes in the story list | ||
export default { | ||
const meta = { | ||
/* 👇 The title prop is optional. | ||
* See https://storybook.js.org/docs/react/configure/overview#configure-story-loading | ||
* to learn how to generate automatic titles | ||
*/ | ||
title: "TabsBar", | ||
component: TabsBar, | ||
} as ComponentMeta<typeof TabsBar>; | ||
|
||
//👇 We create a “template” of how args map to rendering | ||
const Template: ComponentStory<typeof TabsBar> = (args) => ( | ||
<TabsBar {...args} /> | ||
); | ||
} satisfies Meta<typeof TabsBar>; | ||
|
||
export const Default = Template.bind({}); | ||
export default meta; | ||
|
||
Default.args = { | ||
tabs: [ | ||
{ | ||
name: "tab1", | ||
component: <div className="w-250 h-250 bg-green-400">tab1</div>, | ||
}, | ||
{ | ||
name: "tab2", | ||
component: <div className="w-250 h-250 bg-red-400">tab2</div>, | ||
}, | ||
{ | ||
name: "tab3", | ||
component: <div className="w-250 h-250 bg-blue-400">tab3</div>, | ||
}, | ||
], | ||
activeTab: "tab1", | ||
export const Default = { | ||
args: { | ||
tabs: [ | ||
{ | ||
name: "tab1", | ||
component: <div className="w-250 h-250 bg-green-400">tab1</div>, | ||
}, | ||
{ | ||
name: "tab2", | ||
component: <div className="w-250 h-250 bg-red-400">tab2</div>, | ||
}, | ||
{ | ||
name: "tab3", | ||
component: <div className="w-250 h-250 bg-blue-400">tab3</div>, | ||
}, | ||
], | ||
activeTab: "tab1", | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,15 @@ | ||
import { Meta, StoryFn } from "@storybook/react"; | ||
import { Troubleshoot } from "./Troubleshoot"; | ||
|
||
export default { | ||
const meta = { | ||
title: "Troubleshoot", | ||
component: Troubleshoot, | ||
} as Meta<typeof Troubleshoot>; | ||
} satisfies Meta<typeof Troubleshoot>; | ||
|
||
export default meta; | ||
|
||
const Template: StoryFn<typeof Troubleshoot> = () => <Troubleshoot />; | ||
export const Default = Template.bind({}); | ||
|
||
export const Default = { | ||
render: Template, | ||
}; |