Create ResourcePropertiesForm
[arvados-workbench2.git] / src / views-components / resource-properties-form / resource-properties-form.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 { InjectedFormProps, reduxForm } from 'redux-form';
7 import { Grid, Button } from '@material-ui/core';
8 import { PropertyKeyField, PROPERTY_KEY_FIELD_NAME } from './property-key-field';
9 import { PropertyValueField, PROPERTY_VALUE_FIELD_NAME } from './property-value-field';
10
11 export interface ResourcePropertiesFormData {
12     [PROPERTY_KEY_FIELD_NAME]: string;
13     [PROPERTY_VALUE_FIELD_NAME]: string;
14 }
15
16 export const ResourcePropertiesForm = reduxForm({ form: 'rpform' })(
17     ({ handleSubmit }: InjectedFormProps) =>
18         <form onSubmit={handleSubmit}>
19             <Grid container spacing={16}>
20                 <Grid item xs>
21                     <PropertyKeyField />
22                 </Grid>
23                 <Grid item xs>
24                     <PropertyValueField />
25                 </Grid>
26                 <Grid item xs>
27                     <Button variant='contained'>Add</Button>
28                 </Grid>
29             </Grid>
30         </form>);