-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MINOR Improve checkbox field story in pattern lib
- Loading branch information
Showing
2 changed files
with
20 additions
and
20 deletions.
There are no files selected for viewing
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
30 changes: 15 additions & 15 deletions
30
client/src/components/CheckboxField/tests/CheckboxField-story.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,27 @@ | ||
import React from 'react'; | ||
// eslint-disable-next-line import/no-extraneous-dependencies | ||
import { storiesOf } from '@storybook/react'; | ||
import { storiesOf, setAddon } from '@storybook/react'; | ||
import { withKnobs, text, select } from '@storybook/addon-knobs/react'; | ||
import JSXAddon from 'storybook-addon-jsx'; | ||
|
||
import CheckboxField from 'components/CheckboxField/CheckboxField'; | ||
import ValueTracker from 'stories/ValueTracker'; | ||
|
||
const props = { | ||
title: 'one', | ||
value: '1', | ||
}; | ||
setAddon(JSXAddon); | ||
|
||
storiesOf('Admin/CheckboxField', module) | ||
storiesOf('Admin/FormFields', module) | ||
.addDecorator((storyFn) => ( | ||
<ValueTracker>{storyFn()}</ValueTracker> | ||
)) | ||
.add('Checkbox', () => ( | ||
<CheckboxField | ||
{...props} | ||
/> | ||
)) | ||
.add('All titles', () => ( | ||
.addDecorator(withKnobs) | ||
.addWithJSX('CheckboxField', () => ( | ||
<CheckboxField | ||
{...props} | ||
message={{ type: 'error', value: 'My error message' }} | ||
description="This is a description" | ||
title={text('title', 'a checkbox field')} | ||
value={text('value', '1')} | ||
message={{ | ||
type: select('message type', ['', 'error'], 'error'), | ||
value: text('message', 'A message about the field.') } | ||
} | ||
description={text('description', 'A description of the field.')} | ||
/> | ||
)); |