import React from 'react';
import { storiesOf } from '@storybook/react';
import {
action,
actions,
configureActions,
decorate,
decorateAction,
} from '@storybook/addon-actions';
import { setOptions } from '@storybook/addon-options';
import { Button } from '@storybook/react/demo';
import { window, File } from 'global';
const pickNative = decorate([args => [args[0].nativeEvent]]);
const pickNativeAction = decorateAction([args => [args[0].nativeEvent]]);
storiesOf('Addons|Actions', module)
.add('Hello World', () => )
.add('Multiple actions', () => (
))
.add('Multiple actions + config', () => (
))
.add('Multiple actions, object', () => (
))
.add('Multiple actions, object + config', () => (
))
.add('Decorated action', () => (
))
.add('Decorated action + config', () => (
))
.add('Decorated actions', () => (
))
.add('Decorated actions + config', () => (
))
.add('Circular Payload', () => {
const circular = { foo: {} };
circular.foo.circular = circular;
return ;
})
.add('Function Name', () => {
const fn = action('fnName');
return ;
})
.add('Reserved keyword as name', () => )
.add('All types', () => {
function A() {}
function B() {}
const bound = B.bind({});
let file;
try {
file = new File([''], 'filename.txt', { type: 'text/plain', lastModified: new Date() });
} catch (error) {
file = error;
}
const reg = /fooBar/g;
return (
{setOptions({ selectedAddonPanel: 'storybook/actions/actions-panel' })}
);
})
.add('configureActionsDepth', () => {
configureActions({
depth: 2,
});
return (
);
})
.add('Persisting the action logger', () => (
Moving away from this story will persist the action logger
))
.add('Limit Action Output', () => {
configureActions({
limit: 2,
});
return (
);
});
storiesOf('Addons|Actions.deprecated', module).add('Decorated Action', () => (
));