Add new connect form, closes #7
This commit is contained in:
parent
f502fea5c1
commit
6fd5235ec9
16 changed files with 524 additions and 231 deletions
29
client/src/js/components/ui/Checkbox.js
Normal file
29
client/src/js/components/ui/Checkbox.js
Normal file
|
@ -0,0 +1,29 @@
|
|||
import React from 'react';
|
||||
import { Field } from 'formik';
|
||||
|
||||
const Checkbox = ({ name, label, onChange, ...props }) => (
|
||||
<Field
|
||||
name={name}
|
||||
render={({ field, form }) => (
|
||||
<label htmlFor={name}>
|
||||
{label && <div>{label}</div>}
|
||||
<input
|
||||
type="checkbox"
|
||||
id={name}
|
||||
name={name}
|
||||
checked={field.value}
|
||||
onChange={e => {
|
||||
form.setFieldTouched(name, true);
|
||||
field.onChange(e);
|
||||
if (onChange) {
|
||||
onChange(e);
|
||||
}
|
||||
}}
|
||||
{...props}
|
||||
/>
|
||||
</label>
|
||||
)}
|
||||
/>
|
||||
);
|
||||
|
||||
export default Checkbox;
|
Loading…
Add table
Add a link
Reference in a new issue