Created
October 21, 2016 13:51
-
-
Save bnhansn/664b434755fdb560045f6d9d38ac469d to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| // @flow | |
| import React from 'react'; | |
| type Props = { | |
| input: Object, | |
| label?: string, | |
| type?: string, | |
| placeholder?: string, | |
| style?: Object, | |
| meta: Object, | |
| } | |
| const Input = ({ input, label, type, placeholder, style, meta }: Props) => | |
| <div style={{ marginBottom: '1rem' }}> | |
| {label && <label htmlFor={input.name}>{label}</label>} | |
| <input | |
| {...input} | |
| type={type} | |
| placeholder={placeholder} | |
| className="form-control" | |
| style={style && style} | |
| /> | |
| {meta.touched && meta.error && | |
| <div style={{ fontSize: '85%', color: 'rgb(255,59,48)' }}>{meta.error}</div> | |
| } | |
| </div>; | |
| export default Input; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment