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

Addon-actions: Move stories into addon #19082

Merged
merged 8 commits into from
Sep 2, 2022
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
move remaining action stories & cleanup usage of addon-actions everyw…
…here where it serves no further purpose
ndelangen committed Sep 1, 2022

Verified

This commit was signed with the committer’s verified signature.
JasonvanBrackel Jason L. van Brackel
commit 37d518a0e6b8b742265a1fb35b0bb5d48ccd9669
36 changes: 36 additions & 0 deletions code/addons/actions/template/stories/configs.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import globalThis from 'global';

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

const configs = actions('actionA', 'actionB', 'actionC');

export default {
component: globalThis.Components.Button,
args: {
children: 'Click Me!',
},
parameters: {
chromatic: { disable: true },
},
};

export const ActionA = {
args: { onClick: configs.actionA },
};
export const ActionB = {
args: { onClick: configs.actionB },
};
export const ActionC = {
args: { onClick: configs.actionC },
};

export const ConfigureActions = {
args: { onClick: configs.actionA },
decorators: [
(storyFn: any) => {
configureActions({ depth: 2 });

return storyFn();
},
],
};
17 changes: 17 additions & 0 deletions code/addons/actions/template/stories/parameters.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import globalThis from 'global';

export default {
component: globalThis.Components.Button,
args: {
children: 'Click Me!',
},
parameters: {
chromatic: { disable: true },
},
};

export const Basic = {
parameters: {
handles: [{ click: 'clicked', contextmenu: 'right clicked' }],
},
};
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/* eslint-disable jest/no-standalone-expect */
import React from 'react';
import { action } from '@storybook/addon-actions';
import type { ComponentStoryObj, ComponentMeta } from '@storybook/react';
import { CallStates } from '@storybook/instrumenter';
import { styled } from '@storybook/theming';
@@ -48,7 +47,7 @@ export default {
fileName: 'addon-interactions.stories.tsx',
hasException: false,
isPlaying: false,
onScrollToEnd: action('onScrollToEnd'),
onScrollToEnd: () => {},
endRef: null,
// prop for the AddonPanel used as wrapper of Panel
active: true,
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from 'react';

import { action } from '@storybook/addon-actions';
import { Button } from '../react-demo';

export default {
@@ -11,10 +10,10 @@ export default {
},
};

export const WithText = () => <Button onClick={action('clicked')}>Hello Button</Button>;
export const WithText = () => <Button>Hello Button</Button>;

export const WithSomeEmoji = () => (
<Button onClick={action('clicked')}>
<Button>
<span role="img" aria-label="so cool">
😀 😎 👍 💯
</span>

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Story, Meta, ArgsTable, Source } from '@storybook/addon-docs';
import { Button } from '../.././angular-demo';
import { action } from '@storybook/addon-actions';

<Meta title="Addons/Docs/SimpleButton" component={Button} />

@@ -21,7 +20,7 @@ import { action } from '@storybook/addon-actions';
{(args) => ({
props: {
text: args.text,
onClick: action('clicked'),
onClick: () => {},
},
})}
</Story>
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { FormsModule } from '@angular/forms';
import { action } from '@storybook/addon-actions';
import { moduleMetadata, Meta, StoryFn } from '@storybook/angular';
import { CustomCvaComponent } from './custom-cva.component';

@@ -21,7 +20,7 @@ export default {
export const SimpleInput: StoryFn = () => ({
props: {
ngModel: 'Type anything',
ngModelChange: action('ngModelChange'),
ngModelChange: () => {},
},
});

Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Meta, moduleMetadata, StoryFn } from '@storybook/angular';
import { action } from '@storybook/addon-actions';
import { Button } from '../../angular-demo';

export default {
@@ -15,7 +14,7 @@ export const TemplateStory: StoryFn = () => ({
template: `<storybook-button-component [text]="text" (onClick)="onClick($event)"></storybook-button-component>`,
props: {
text: 'Button with custom styles',
onClick: action('log'),
onClick: () => {},
},
styles: [
`
5 changes: 2 additions & 3 deletions code/examples/cra-kitchen-sink/src/stories/button.stories.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
import React from 'react';
import { action } from '@storybook/addon-actions';
import { Button } from '../components/react-demo';

export default {
title: 'Button',
component: Button,
};

export const Story1 = () => <Button onClick={action('clicked', { depth: 1 })}>Hello Button</Button>;
export const Story1 = () => <Button>Hello Button</Button>;
Story1.storyName = 'with text';

Story1.parameters = {
options: { selectedPanel: 'storybook/actions/panel' },
};

export const Story2 = () => (
<Button onClick={action('clicked')}>
<Button>
<span role="img" aria-label="yolo">
😀 😎 👍 💯
</span>
10 changes: 4 additions & 6 deletions code/examples/cra-kitchen-sink/src/stories/decorators.stories.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from 'react';
import { action } from '@storybook/addon-actions';
import PropTypes from 'prop-types';
import { Button } from '../components/react-demo';

@@ -24,13 +23,12 @@ export default {
};

export const WithArgs = (args) => <Button {...args} />;
WithArgs.args = { onClick: action('clicked', { depth: 1 }), children: 'With args' };
WithArgs.args = { children: 'With args' };

export const Basic = () => <Button onClick={action('clicked', { depth: 1 })}>Basic</Button>;
export const Basic = () => <Button>Basic</Button>;

export const Nested = (args) => (
<Button {...args}>
export const Nested = () => (
<Button>
<Bold>Hello</Bold>
</Button>
);
Nested.args = { onClick: action('clicked', { depth: 1 }) };
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import React from 'react';
import { action } from '@storybook/addon-actions';
import { Button } from '../components/react-demo';

export default {
title: 'Some really long story kind description',
};

export const Story1 = () => <Button onClick={action('clicked')}>Hello Button</Button>;
export const Story1 = () => <Button>Hello Button</Button>;
Story1.storyName = 'with text';
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from 'react';
import { action } from '@storybook/addon-actions';
import Button, { Type } from './Button';

export default {
@@ -9,7 +8,7 @@ export default {

export const SimpleButton = () => {
const x = 0;
return <Button onClick={action('button clicked')}>OK {x}</Button>;
return <Button>OK {x}</Button>;
};

const typeOptions = {
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import React from 'react';
import { action } from '@storybook/addon-actions';
import { Button } from './Button';

export default {
title: '1-Button',
component: Button,
};

export const Text = () => <Button onClick={action('clicked')}>Hello Button</Button>;
export const Text = () => <Button>Hello Button</Button>;

export const Emoji = () => (
<Button onClick={action('clicked')}>
<Button>
<span role="img" aria-label="so cool">
😀 😎 👍 💯
</span>
18 changes: 0 additions & 18 deletions code/examples/ember-cli/stories/addon-actions.stories.js

This file was deleted.

3 changes: 0 additions & 3 deletions code/examples/ember-cli/stories/welcome-banner.stories.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { hbs } from 'ember-cli-htmlbars';
import { action } from '@storybook/addon-actions';

export default {
title: 'welcome-banner',
@@ -23,7 +22,6 @@ export const Basic = (args) => ({
subTitleColor=subTitleColor
title=title
subtitle=subtitle
click=(action onClick)
}}
`,
context: args,
@@ -34,5 +32,4 @@ Basic.args = {
subTitleColor: '#B8854F',
title: 'Welcome to storybook',
subtitle: 'This environment is completely editable',
onClick: action('clicked'),
};
Loading