Browse Source

feat(ui): Add Form component

Component that wraps Informed.Form as a Styled System component.
renovate/lint-staged-8.x
Tom Kirkpatrick 6 years ago
parent
commit
6f9ff91ad6
No known key found for this signature in database GPG Key ID: 72203A8EC5967EA8
  1. 12
      app/components/UI/Form.js
  2. 1
      app/components/UI/index.js
  3. 10
      test/unit/components/UI/Form.spec.js
  4. 9
      test/unit/components/UI/__snapshots__/Form.spec.js.snap

12
app/components/UI/Form.js

@ -0,0 +1,12 @@
import system from '@rebass/components'
import { styles } from 'styled-system'
import { Form as InformedForm } from 'informed'
// Create an html input element that accepts all style props from styled-system.
const Form = system(
{
extend: InformedForm
},
...Object.keys(styles)
)
export default Form

1
app/components/UI/index.js

@ -6,6 +6,7 @@ export Button from './Button'
export CryptoAmountInput from './CryptoAmountInput'
export Dropdown from './Dropdown'
export FiatAmountInput from './FiatAmountInput'
export Form from './Form'
export FormFieldMessage from './FormFieldMessage'
export GlobalStyle from './GlobalStyle'
export Heading from './Heading'

10
test/unit/components/UI/Form.spec.js

@ -0,0 +1,10 @@
import React from 'react'
import renderer from 'react-test-renderer'
import { Form } from 'components/UI'
describe('component.UI.Form', () => {
it('should render correctly', () => {
const tree = renderer.create(<Form />).toJSON()
expect(tree).toMatchSnapshot()
})
})

9
test/unit/components/UI/__snapshots__/Form.spec.js.snap

@ -0,0 +1,9 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`component.UI.Form should render correctly 1`] = `
<form
className=""
onReset={[Function]}
onSubmit={[Function]}
/>
`;
Loading…
Cancel
Save