2021-10-03 20:23:06 +00:00
|
|
|
import { Field } from 'formik';
|
2020-02-23 04:07:56 +00:00
|
|
|
import React from 'react';
|
2021-10-01 17:07:48 +00:00
|
|
|
import tw from 'twin.macro';
|
2021-10-03 20:23:06 +00:00
|
|
|
import Label from '@/components/elements/Label';
|
2020-02-23 04:07:56 +00:00
|
|
|
|
|
|
|
interface Props {
|
2021-10-03 20:23:06 +00:00
|
|
|
id: string;
|
2020-02-23 04:07:56 +00:00
|
|
|
name: string;
|
2021-10-01 17:07:48 +00:00
|
|
|
label?: string;
|
2020-07-11 22:37:59 +00:00
|
|
|
className?: string;
|
2020-02-23 04:07:56 +00:00
|
|
|
}
|
|
|
|
|
2021-10-03 20:23:06 +00:00
|
|
|
const Checkbox = ({ id, name, label, className }: Props) => (
|
|
|
|
<div css={tw`flex flex-row`} className={className}>
|
|
|
|
<Field type={'checkbox'} id={id} name={name} css={[ label && tw`mr-2` ]}/>
|
|
|
|
{label &&
|
|
|
|
<div css={tw`flex-1`}>
|
|
|
|
<Label noBottomSpacing>{label}</Label>
|
|
|
|
</div>}
|
|
|
|
</div>
|
2020-02-23 04:07:56 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
export default Checkbox;
|