add checkbox field component and change advance form
[arvados-workbench2.git] / src / components / checkbox-field / checkbox-field.tsx
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import * as React from 'react';
6 import { WrappedFieldProps } from 'redux-form';
7 import { ArvadosTheme } from '~/common/custom-theme';
8 import { FormControlLabel, Checkbox, StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core';
9
10 type CssRules = 'checkboxField';
11
12 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
13     checkboxField: {
14         
15     }
16 });
17
18 export const CheckboxField = withStyles(styles)((props: WrappedFieldProps & WithStyles<CssRules> & { label?: string }) =>
19     <FormControlLabel
20         control={
21             <Checkbox
22                 checked={props.input.value}
23                 onChange={props.input.onChange}
24                 color="primary" />
25         }
26         label={props.label} 
27     />);