|
1 | 1 | import * as E from '../../typings/error' |
2 | | -import { action } from '@storybook/addon-actions' |
3 | | -import { storiesOf } from '@storybook/react' |
4 | 2 | import React from 'react' |
5 | 3 | import ErrorView from '../src/components/Error' |
6 | | -import SideBarDecorator from './utils/SideBarDecorator' |
7 | 4 |
|
8 | | -storiesOf('Error', module) |
9 | | - .addDecorator(SideBarDecorator) |
10 | | - .add('Error', () => { |
11 | | - const error: E.ErrorMessage = { |
12 | | - type: 'UnknownError', |
13 | | - message: '### Message summary\n\nSome message about what went wrong under here', |
14 | | - actions: [ |
15 | | - { label: 'First', transition: 'FIRST' }, |
16 | | - { label: 'Second', transition: 'SECOND' }, |
17 | | - ], |
18 | | - } |
19 | | - return <ErrorView error={error} send={action('send')} /> |
20 | | - }) |
| 5 | +const Error = ({ send }) => { |
| 6 | + const error: E.ErrorMessage = { |
| 7 | + type: 'UnknownError', |
| 8 | + message: '### Message summary\n\nSome message about what went wrong under here', |
| 9 | + actions: [ |
| 10 | + { label: 'First', transition: 'FIRST' }, |
| 11 | + { label: 'Second', transition: 'SECOND' }, |
| 12 | + ], |
| 13 | + } |
| 14 | + return <ErrorView error={error} send={send} /> |
| 15 | +} |
| 16 | + |
| 17 | +export default { |
| 18 | + /* 👇 The title prop is optional. |
| 19 | + * See https://storybook.js.org/docs/react/configure/overview#configure-story-loading |
| 20 | + * to learn how to generate automatic titles |
| 21 | + */ |
| 22 | + title: 'Error', |
| 23 | + component: ErrorView, |
| 24 | + argTypes: { send: { action: 'send' } }, |
| 25 | +} |
| 26 | + |
| 27 | +export const Primary = () => <Error /> |
0 commit comments