X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/dd89200ad6fdbfa337fdbab5f54def8712c6746c..4927f812339c86a8d84354c4080c5a12a3d9ef2b:/src/views/collection-panel/collection-tag-form.tsx

diff --git a/src/views/collection-panel/collection-tag-form.tsx b/src/views/collection-panel/collection-tag-form.tsx
index 8f254041..9aa88128 100644
--- a/src/views/collection-panel/collection-tag-form.tsx
+++ b/src/views/collection-panel/collection-tag-form.tsx
@@ -6,30 +6,37 @@ import * as React from 'react';
 import { reduxForm, Field, reset } from 'redux-form';
 import { compose, Dispatch } from 'redux';
 import { ArvadosTheme } from '~/common/custom-theme';
-import { StyleRulesCallback, withStyles, WithStyles, TextField, Button, CircularProgress } from '@material-ui/core';
+import { StyleRulesCallback, withStyles, WithStyles, Button, CircularProgress, Grid, Typography } from '@material-ui/core';
 import { TagProperty } from '~/models/tag';
+import { TextField } from '~/components/text-field/text-field';
 import { createCollectionTag, COLLECTION_TAG_FORM_NAME } from '~/store/collection-panel/collection-panel-action';
 import { TAG_VALUE_VALIDATION, TAG_KEY_VALIDATION } from '~/validators/validators';
 
-type CssRules = 'form' | 'textField' | 'buttonWrapper' | 'saveButton' | 'circularProgress';
+type CssRules = 'root' | 'keyField' | 'valueField' | 'buttonWrapper' | 'saveButton' | 'circularProgress';
 
 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
-    form: {
-        marginBottom: theme.spacing.unit * 4
+    root: {
+        width: '100%',
+        display: 'flex'
     },
-    textField: {
-        marginRight: theme.spacing.unit
+    keyField: {
+        width: '25%',
+        marginRight: theme.spacing.unit * 3
+    },
+    valueField: {
+        width: '40%',
+        marginRight: theme.spacing.unit * 3
     },
     buttonWrapper: {
+        paddingTop: '14px',
         position: 'relative',
-        display: 'inline-block'
     },
     saveButton: {
         boxShadow: 'none'
     },
     circularProgress: {
         position: 'absolute',
-        top: 0,
+        top: -9,
         bottom: 0,
         left: 0,
         right: 0,
@@ -47,14 +54,6 @@ interface CollectionTagFormActionProps {
     handleSubmit: any;
 }
 
-interface TextFieldProps {
-    label: string;
-    floatinglabeltext: string;
-    className?: string;
-    input?: string;
-    meta?: any;
-}
-
 type CollectionTagFormProps = CollectionTagFormDataProps & CollectionTagFormActionProps & WithStyles<CssRules>;
 
 export const CollectionTagForm = compose(
@@ -67,26 +66,26 @@ export const CollectionTagForm = compose(
     }),
     withStyles(styles))(
 
-    class CollectionTagForm extends React.Component<CollectionTagFormProps> {
+        class CollectionTagForm extends React.Component<CollectionTagFormProps> {
 
             render() {
                 const { classes, submitting, pristine, invalid, handleSubmit } = this.props;
                 return (
-                    <form className={classes.form} onSubmit={handleSubmit}>
-                        <Field name="key"
-                            disabled={submitting}
-                            component={this.renderTextField}
-                            floatinglabeltext="Key"
-                            validate={TAG_KEY_VALIDATION}
-                            className={classes.textField}
-                            label="Key" />
-                        <Field name="value"
-                            disabled={submitting}
-                            component={this.renderTextField}
-                            floatinglabeltext="Value"
-                            validate={TAG_VALUE_VALIDATION}
-                            className={classes.textField}
-                            label="Value" />
+                    <form onSubmit={handleSubmit} className={classes.root}>
+                        <div className={classes.keyField}>
+                            <Field name="key"
+                                disabled={submitting}
+                                component={TextField}
+                                validate={TAG_KEY_VALIDATION}
+                                label="Key" />
+                        </div>
+                        <div className={classes.valueField}>
+                            <Field name="value"
+                                disabled={submitting}
+                                component={TextField}
+                                validate={TAG_VALUE_VALIDATION}
+                                label="Value" />
+                        </div>
                         <div className={classes.buttonWrapper}>
                             <Button type="submit" className={classes.saveButton}
                                 color="primary"
@@ -100,19 +99,6 @@ export const CollectionTagForm = compose(
                     </form>
                 );
             }
-
-            renderTextField = ({ input, label, meta: { touched, error }, ...custom }: TextFieldProps) => (
-                <TextField
-                    helperText={touched && error}
-                    label={label}
-                    className={this.props.classes.textField}
-                    error={touched && !!error}
-                    autoComplete='off'
-                    {...input}
-                    {...custom}
-                />
-            )
-
         }
 
     );
