Add colored nicks settings option

This commit is contained in:
Ken-Håvard Lieng 2018-10-15 08:56:17 +02:00
parent ec03db4db6
commit 6c6a9e12cf
27 changed files with 577 additions and 109 deletions

View file

@ -1,30 +1,18 @@
import React from 'react';
import { Field } from 'formik';
import classnames from 'classnames';
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}
/>
<span />
</label>
)}
/>
const Checkbox = ({ name, label, topLabel, ...props }) => (
<label
className={classnames('checkbox', {
'top-label': topLabel
})}
htmlFor={name}
>
{topLabel && label}
<input type="checkbox" id={name} name={name} {...props} />
<span />
{!topLabel && label}
</label>
);
export default Checkbox;