import React from 'react' ; import { storiesOf } from '@storybook/react' ; import { action } from '@storybook/addon-actions' ; import { object , text } from '@storybook/addon-knobs' ; import { EmailForm } from '../EmailForm' ; import { FormLabelPosition } from '../Form' ; const defaultStyle = { padding : 10 } ; const defaultValue = { email : 'test@bb.com' } ; const renderEmailForm = ( labelPosition ? ) : ( ( ) => JSX . Element ) => { return ( ( ) => ( < EmailForm value = { object ( 'value' , defaultValue ) } style = { object ( 'style' , defaultStyle ) } submitText = { text ( 'submitText' , 'SUBMIT' ) } onSubmit = { action ( 'EmailForm onSubmit' ) } labelPosition = { labelPosition } / > ) ) ; } ; storiesOf ( 'EmailForm' , module ) . add ( 'basic usage' , renderEmailForm ( ) ) . add ( 'label above' , renderEmailForm ( FormLabelPosition . Above ) ) . add ( 'label hidden' , renderEmailForm ( FormLabelPosition . Hidden ) ) . add ( 'label floating' , renderEmailForm ( FormLabelPosition . Floating ) ) ;