Extract autocomplete, people-select
[arvados.git] / src / views-components / sharing-dialog / sharing-invitation-form-component.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 { Field, WrappedFieldProps } from 'redux-form';
7 import { Grid, Input, FormControl, FormHelperText, FormLabel, InputLabel, Chip } from '@material-ui/core';
8 import { ChipsInput } from '~/components/chips-input/chips-input';
9 import { identity } from 'lodash';
10 import { PermissionSelect } from './permission-select';
11 import { PeopleSelect } from './people-select';
12 import ChipInput from 'material-ui-chip-input';
13
14 export default () =>
15     <Grid container spacing={8}>
16         <Grid item xs={8}>
17             <InvitedPeopleField />
18         </Grid>
19         <Grid item xs={4}>
20             <PermissionSelectField />
21         </Grid>
22     </Grid>;
23
24 const InvitedPeopleField = () =>
25     <Field
26         name='invitedPeople'
27         component={InvitedPeopleFieldComponent} />;
28
29
30 const InvitedPeopleFieldComponent = (props: WrappedFieldProps) =>
31     <PeopleSelect suggestedPeople={[]} />;
32
33 const PermissionSelectField = () =>
34     <Field
35         name='permission'
36         component={PermissionSelectComponent} />;
37
38 const PermissionSelectComponent = ({ input }: WrappedFieldProps) =>
39     <FormControl fullWidth>
40         <InputLabel>Authorization</InputLabel>
41         <PermissionSelect {...input} />
42     </FormControl>;