Created
January 25, 2020 18:56
-
-
Save ptvandi/4652941b0bd6080deb318cfc7bde1c62 to your computer and use it in GitHub Desktop.
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
// src/components/Task.stories.js | |
import React from 'react'; | |
import { storiesOf } from '@storybook/react'; | |
import { action } from '@storybook/addon-actions'; | |
import Task from './Task'; | |
function buildStory(attrs) { | |
const task = { | |
id: Math.round(Math.random() * 1000000).toString(), | |
title: 'Test Task', | |
subtitle: 'on Test Board', | |
url: 'http://test.url', | |
state: 'TASK_INBOX', | |
updatedAt: Date.now(), | |
...attrs, | |
}; | |
const onPinTask = action('onPinTask'); | |
const onSnoozeTask = action('onSnoozeTask'); | |
return <Task {...{ task, onPinTask, onSnoozeTask }} />; | |
} | |
storiesOf('Task', module) | |
.addDecorator(story => ( | |
<div className="list-items" style={{ background: 'white' }}>{story()}</div> | |
)) | |
.add('inbox task', () => buildStory({ state: 'TASK_INBOX' })) | |
.add('snoozed task', () => buildStory({ state: 'TASK_SNOOZED' })) | |
.add('pinned task', () => buildStory({ state: 'TASK_PINNED' })) | |
.add('archived task', () => buildStory({ state: 'TASK_ARCHIVED' })); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment