Skip to content

Commit

Permalink
Merge pull request #18527 from storybookjs/future/SB-444-cleanup
Browse files Browse the repository at this point in the history
cleanup SB-444 examples
  • Loading branch information
ndelangen authored Jun 21, 2022
2 parents d4c22e2 + 0498b96 commit 0982008
Show file tree
Hide file tree
Showing 195 changed files with 558 additions and 673 deletions.
2 changes: 1 addition & 1 deletion docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ We're aware that the default Typescript story construct might seem outdated and
// Button.stories.ts | tsx
import React from 'react';
import { ComponentStory, ComponentMeta } from '@storybook/react';
import type { ComponentStory, ComponentMeta } from '@storybook/react';
const StoryMeta: ComponentMeta<typeof Button> = {
/* 👇 The title prop is optional.
Expand Down
4 changes: 2 additions & 2 deletions docs/snippets/react/app-story-with-mock.ts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import React from 'react';

import { ComponentStory, ComponentMeta } from '@storybook/react';
import type { ComponentStoryFn, ComponentMeta } from '@storybook/react';

import App from './App';

Expand All @@ -16,7 +16,7 @@ export default {
component: App,
} as ComponentMeta<typeof App>;

const Template: ComponentStory<typeof App> = () => <App />;
const Template: ComponentStoryFn<typeof App> = () => <App />;

export const Success = Template.bind({});
Success.parameters = {
Expand Down
4 changes: 2 additions & 2 deletions docs/snippets/react/button-group-story.ts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import React from 'react';

import { ComponentStory, ComponentMeta } from '@storybook/react';
import type { ComponentStoryFn, ComponentMeta } from '@storybook/react';

import { ButtonGroup } from '../ButtonGroup';

Expand All @@ -19,7 +19,7 @@ export default {
component: ButtonGroup,
} as ComponentMeta<typeof ButtonGroup>;

const Template: ComponentStory<typeof ButtonGroup> = (args) => <ButtonGroup {...args} />;
const Template: ComponentStoryFn<typeof ButtonGroup> = (args) => <ButtonGroup {...args} />;

export const Pair = Template.bind({});
Pair.args = {
Expand Down
4 changes: 2 additions & 2 deletions docs/snippets/react/button-story-click-handler.ts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import React from 'react';

import { ComponentStory, ComponentMeta } from '@storybook/react';
import type { ComponentStoryFn, ComponentMeta } from '@storybook/react';

import { action } from '@storybook/addon-actions';

Expand All @@ -18,5 +18,5 @@ export default {
component: Button,
} as ComponentMeta<typeof Button>;

export const Basic: ComponentStory<typeof Button> = () => <Button label="Hello" onClick={action('clicked')} />;
export const Basic: ComponentStoryFn<typeof Button> = () => <Button label="Hello" onClick={action('clicked')} />;
```
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import React from 'react';

import { ComponentStory, ComponentMeta } from '@storybook/react';
import type { ComponentStoryFn, ComponentMeta } from '@storybook/react';

export default {
/* 👇 The title prop is optional.
Expand All @@ -14,7 +14,7 @@ export default {
component: Button,
} as ComponentMeta<typeof Button>;

const Template: ComponentStory<typeof Button> = (args) => <Button {...args} />;
const Template: ComponentStoryFn<typeof Button> = (args) => <Button {...args} />;

export const Primary = Template.bind({});
Primary.decorators = [(Story) => <div style={{ margin: '3em' }}>{Story()}</div>];
Expand Down
4 changes: 2 additions & 2 deletions docs/snippets/react/button-story-decorator.ts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import React from 'react';

import { ComponentStory, ComponentMeta } from '@storybook/react';
import type { ComponentStoryFn, ComponentMeta } from '@storybook/react';

export default {
/* 👇 The title prop is optional.
Expand All @@ -14,7 +14,7 @@ export default {
component: Button,
} as ComponentMeta<typeof Button>;

const Template: ComponentStory<typeof Button> = (args) => <Button {...args} />;
const Template: ComponentStoryFn<typeof Button> = (args) => <Button {...args} />;

export const Primary = Template.bind({});
Primary.decorators = [
Expand Down
4 changes: 2 additions & 2 deletions docs/snippets/react/button-story-default-docs-code.ts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import React from 'react';

import { ComponentStory, ComponentMeta } from '@storybook/react';
import type { ComponentStoryFn, ComponentMeta } from '@storybook/react';

import { Button } from './Button';

Expand All @@ -25,7 +25,7 @@ export default {
},
} as ComponentMeta<typeof Button>;

export const ExampleStory: ComponentStory<typeof Button> = (args) => {
export const ExampleStory: ComponentStoryFn<typeof Button> = (args) => {
//👇 Destructure the label from the args object
const { label } = args;

Expand Down
4 changes: 2 additions & 2 deletions docs/snippets/react/button-story-rename-story.ts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import React from 'react';

import { ComponentStory, ComponentMeta } from '@storybook/react';
import type { ComponentStoryFn, ComponentMeta } from '@storybook/react';

import { Button } from './Button';

Expand All @@ -16,6 +16,6 @@ export default {
component: Button,
} as ComponentMeta<typeof Button>;

export const Primary: ComponentStory<typeof Button> = () => <Button primary label="Button"/>;
export const Primary: ComponentStoryFn<typeof Button> = () => <Button primary label="Button"/>;
Primary.storyName = 'I am the primary';
```
4 changes: 2 additions & 2 deletions docs/snippets/react/button-story-using-args.ts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import React from 'react';

import { ComponentStory, ComponentMeta } from '@storybook/react';
import type { ComponentStoryFn, ComponentMeta } from '@storybook/react';

import { Button } from './Button';

Expand All @@ -17,7 +17,7 @@ export default {
} as ComponentMeta<typeof Button>;

//👇 We create a “template” of how args map to rendering
const Template: ComponentStory<typeof Button> = (args) => <Button {...args} />;
const Template: ComponentStoryFn<typeof Button> = (args) => <Button {...args} />;

//👇 Each story then reuses that template
export const Primary = Template.bind({});
Expand Down
4 changes: 2 additions & 2 deletions docs/snippets/react/button-story-with-addon-example.ts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import React from 'react';

import { ComponentStory, ComponentMeta } from '@storybook/react';
import type { ComponentStoryFn, ComponentMeta } from '@storybook/react';

import { Button } from './Button';

Expand All @@ -22,5 +22,5 @@ export default {
},
} as ComponentMeta<typeof Button>;

const Basic: ComponentStory<typeof Button> = () => <Button>hello</Button>;
const Basic: ComponentStoryFn<typeof Button> = () => <Button>hello</Button>;
```
4 changes: 2 additions & 2 deletions docs/snippets/react/button-story-with-args.ts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import React from 'react';

import { ComponentStory, ComponentMeta } from '@storybook/react';
import type { ComponentStoryFn, ComponentMeta } from '@storybook/react';

import { Button, ButtonProps } from './Button';

Expand All @@ -17,7 +17,7 @@ export default {
} as ComponentMeta<typeof Button>;

//👇 We create a “template” of how args map to rendering
const Template: ComponentStory<typeof Button> = (args) => <Button {...args} />;
const Template: ComponentStoryFn<typeof Button> = (args) => <Button {...args} />;

export const Primary = Template.bind({});

Expand Down
8 changes: 4 additions & 4 deletions docs/snippets/react/button-story-with-emojis.ts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import React from 'react';

import { ComponentStory, ComponentMeta } from '@storybook/react';
import type { ComponentStoryFn, ComponentMeta } from '@storybook/react';

import { Button } from './Button';

Expand All @@ -16,15 +16,15 @@ export default {
component: Button,
} as ComponentMeta<typeof Button>;

export const Primary: ComponentStory<typeof Button> = () => (
export const Primary: ComponentStoryFn<typeof Button> = () => (
<Button backgroundColor="#ff0" label="Button" />
);

export const Secondary: ComponentStory<typeof Button> = () => (
export const Secondary: ComponentStoryFn<typeof Button> = () => (
<Button backgroundColor="#ff0" label="😄👍😍💯" />
);

export const Tertiary: ComponentStory<typeof Button> = () => (
export const Tertiary: ComponentStoryFn<typeof Button> = () => (
<Button backgroundColor="#ff0" label="📚📕📈🤓" />
);
```
4 changes: 2 additions & 2 deletions docs/snippets/react/button-story.ts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import React from 'react';

import { ComponentStory, ComponentMeta } from '@storybook/react';
import type { ComponentStoryFn, ComponentMeta } from '@storybook/react';

import { Button } from './Button';

Expand All @@ -16,5 +16,5 @@ export default {
component: Button,
} as ComponentMeta<typeof Button>;

export const Primary: ComponentStory<typeof Button> = () => <Button primary>Button</Button>;
export const Primary: ComponentStoryFn<typeof Button> = () => <Button primary>Button</Button>;
```
4 changes: 2 additions & 2 deletions docs/snippets/react/checkbox-story-csf.ts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import React from 'react';

import { ComponentMeta, ComponentStory } from '@storybook/react';
import { ComponentMeta, ComponentStoryFn } from '@storybook/react';

import { Checkbox } from './Checkbox';

Expand All @@ -16,7 +16,7 @@ export default {
component: Checkbox,
} as ComponentMeta<typeof Checkbox>;

export const allCheckboxes: ComponentStory<typeof Checkbox> = () => (
export const allCheckboxes: ComponentStoryFn<typeof Checkbox> = () => (
<form>
<Checkbox id="Unchecked" label="Unchecked" />
<Checkbox id="Checked" label="Checked" checked />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import React from 'react';

import { ComponentStory, ComponentMeta } from '@storybook/react';
import type { ComponentStoryFn, ComponentMeta } from '@storybook/react';

import { YourComponent } from './your-component';

Expand All @@ -30,7 +30,7 @@ export default {
},
} as ComponentMeta<typeof YourComponent>;

const Template: ComponentStory<typeof YourComponent> = ({ propertyA, propertyB, ...rest }) => {
const Template: ComponentStoryFn<typeof YourComponent> = ({ propertyA, propertyB, ...rest }) => {
//👇 Assigns the result from the function to a variable
const someFunctionResult = someFunction(propertyA, propertyB);

Expand Down
4 changes: 2 additions & 2 deletions docs/snippets/react/component-story-figma-integration.ts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import React from 'react';

import { ComponentStory, ComponentMeta } from '@storybook/react';
import type { ComponentStoryFn, ComponentMeta } from '@storybook/react';

import { withDesign } from 'storybook-addon-designs';

Expand All @@ -17,7 +17,7 @@ export default {
} as ComponentMeta<typeof YourComponent>;

// More on component templates: https://storybook.js.org/docs/react/writing-stories/introduction#using-args
const Template: ComponentStory<typeof MyComponent> = () => <MyComponent />;
const Template: ComponentStoryFn<typeof MyComponent> = () => <MyComponent />;

export const Example = Template.bind({});
Example.parameters = {
Expand Down
4 changes: 2 additions & 2 deletions docs/snippets/react/component-story-with-accessibility.ts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import React from 'react';

import { ComponentStory, ComponentMeta } from '@storybook/react';
import type { ComponentStoryFn, ComponentMeta } from '@storybook/react';

import { Button } from './Button';

Expand All @@ -19,7 +19,7 @@ export default {
} as ComponentMeta<typeof Button>;


const Template: ComponentStory<typeof Button> = (args) => <Button {...args} />;
const Template: ComponentStoryFn<typeof Button> = (args) => <Button {...args} />;

// This is an accessible story
export const Accessible = Template.bind({});
Expand Down
8 changes: 4 additions & 4 deletions docs/snippets/react/list-story-expanded.ts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import React from 'react';

import { ComponentStory, ComponentMeta } from '@storybook/react';
import type { ComponentStoryFn, ComponentMeta } from '@storybook/react';

import { List } from './List';
import { ListItem } from './ListItem';
Expand All @@ -17,15 +17,15 @@ export default {
component: List,
} as ComponentMeta<typeof List>;

export const Empty: ComponentStory<typeof List> = (args) => <List {...args} />;
export const Empty: ComponentStoryFn<typeof List> = (args) => <List {...args} />;

export const OneItem: ComponentStory<typeof List> = (args) => (
export const OneItem: ComponentStoryFn<typeof List> = (args) => (
<List {...args}>
<ListItem />
</List>
);

export const ManyItems: ComponentStory<typeof List> = (args) => (
export const ManyItems: ComponentStoryFn<typeof List> = (args) => (
<List {...args}>
<ListItem />
<ListItem />
Expand Down
4 changes: 2 additions & 2 deletions docs/snippets/react/list-story-reuse-data.ts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import React from 'react';

import { ComponentStory, ComponentMeta } from '@storybook/react';
import type { ComponentStoryFn, ComponentMeta } from '@storybook/react';

import { List } from './List';
import { ListItem } from './ListItem';
Expand All @@ -20,7 +20,7 @@ export default {
component: List,
} as ComponentMeta<typeof List>;

export const ManyItems: ComponentStory<typeof List> = (args) => (
export const ManyItems: ComponentStoryFn<typeof List> = (args) => (
<List {...args}>
<Selected {...ListItemStories.Selected.args} />
<Unselected {...ListItemStories.Unselected.args} />
Expand Down
4 changes: 2 additions & 2 deletions docs/snippets/react/list-story-starter.ts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import React from 'react';

import { ComponentStory, ComponentMeta } from '@storybook/react';
import type { ComponentStoryFn, ComponentMeta } from '@storybook/react';

import { List } from './List';

Expand All @@ -17,5 +17,5 @@ export default {
} as ComponentMeta<typeof List>;

//👇 Always an empty list, not super interesting
const Template: ComponentStory<typeof List> = (args) => <List {...args} />;
const Template: ComponentStoryFn<typeof List> = (args) => <List {...args} />;
```
4 changes: 2 additions & 2 deletions docs/snippets/react/list-story-template.ts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import React from 'react';

import { ComponentStory, ComponentMeta } from '@storybook/react';
import type { ComponentStoryFn, ComponentMeta } from '@storybook/react';

import { List } from './List';
import { ListItem } from './ListItem';
Expand All @@ -20,7 +20,7 @@ export default {
component: List,
} as ComponentMeta<typeof List>;

const ListTemplate: ComponentStory<typeof ButtonGroup> = (args) => {
const ListTemplate: ComponentStoryFn<typeof ButtonGroup> = (args) => {
const { items } = args;
return (
<List>
Expand Down
Loading

0 comments on commit 0982008

Please sign in to comment.