@navinc/base-react-components
Version:
Nav's Pattern Library
54 lines (46 loc) • 1.34 kB
JavaScript
import React from 'react'
import styled from 'styled-components'
import withPropsCombinations from 'react-storybook-addon-props-combinations'
import CCInput from './cc-input.js'
import readme from './cc-input.readme.md'
window.process = window.process || {}
window.process.env = window.process.env || {}
window.process.env.CLIENT_BILLING_PUBLIC_KEY = 'pk_test_ajAJtGiHtTI4ra7mfled2kbV'
const CreditCardInput = styled(CCInput)`
width: 100%;
`
export default {
title: 'Form Elements/CCInput',
component: CreditCardInput,
parameters: {
info: { text: readme },
},
}
export const Basic = (args) => {
return <CreditCardInput onBlur={(event) => console.log(event)} {...args} />
}
Basic.args = {
lede: 'Input lede',
label: 'Input some text',
type: '',
value: 'I am an input component',
placeholder: 'placeholder',
required: false,
hasSpaceForErrors: true,
isInvalid: false,
errors: [],
onChange: 'yourFunction()',
onBlur: 'blurFunction()',
createTokenRef: 'function()',
}
export const Variations = withPropsCombinations(CCInput, {
label: ['Input some text'],
type: ['text'],
value: ['I am an input component'],
hasSpaceForErrors: [false, true],
isInvalid: [false, true],
errors: [[], ['An error'], ['One error', 'Two Errors']],
})
Variations.parameters = {
info: { disable: true },
}