misc_pterodactyl-panel/resources/scripts/components/elements/Checkbox.tsx

24 lines
594 B
TypeScript
Raw Normal View History

2021-10-03 20:23:06 +00:00
import { Field } from 'formik';
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';
interface Props {
2021-10-03 20:23:06 +00:00
id: string;
name: string;
2021-10-01 17:07:48 +00:00
label?: string;
2020-07-11 22:37:59 +00:00
className?: string;
}
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>
);
export default Checkbox;