Merge remote-tracking branch 'origin/main' into 18207-Workbench2-is-not-clearing...
[arvados-workbench2.git] / src / views-components / dialog-create / dialog-collection-create.tsx
index 163eb9831ec9a0b6a4ad52abb3dca89d48a05820..17a24e480cf771a8dda6fafe96d24fc4da6bc204 100644 (file)
@@ -15,34 +15,46 @@ import {
 import { FileUploaderField } from '../file-uploader/file-uploader';
 import { ResourceParentField } from '../form-fields/resource-form-fields';
 import { CreateCollectionPropertiesForm } from 'views-components/collection-properties/create-collection-properties-form';
-import { FormGroup, FormLabel } from '@material-ui/core';
+import { FormGroup, FormLabel, StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core';
 import { resourcePropertiesList } from 'views-components/resource-properties/resource-properties-list';
 
+type CssRules = 'propertiesForm';
+
+const styles: StyleRulesCallback<CssRules> = theme => ({
+    propertiesForm: {
+        marginTop: theme.spacing.unit * 2,
+        marginBottom: theme.spacing.unit * 2,
+    },
+});
+
 type DialogCollectionProps = WithDialogProps<{}> & InjectedFormProps<CollectionCreateFormDialogData>;
 
 export const DialogCollectionCreate = (props: DialogCollectionProps) =>
     <FormDialog
         dialogTitle='New collection'
-        formFields={CollectionAddFields}
+        formFields={CollectionAddFields as any}
         submitLabel='Create a Collection'
         {...props}
     />;
 
 const CreateCollectionPropertiesList = resourcePropertiesList(COLLECTION_CREATE_FORM_NAME);
 
-const CollectionAddFields = () => <span>
-    <ResourceParentField />
-    <CollectionNameField />
-    <CollectionDescriptionField />
-    <FormLabel>Properties</FormLabel>
-    <FormGroup>
-        <CreateCollectionPropertiesForm />
-        <CreateCollectionPropertiesList />
-    </FormGroup>
-    <CollectionStorageClassesField defaultClasses={['default']} />
-    <Field
-        name='files'
-        label='Files'
-        component={FileUploaderField} />
-</span>;
+const CollectionAddFields = withStyles(styles)(
+    ({ classes }: WithStyles<CssRules>) => <span>
+        <ResourceParentField />
+        <CollectionNameField />
+        <CollectionDescriptionField />
+        <div className={classes.propertiesForm}>
+            <FormLabel>Properties</FormLabel>
+            <FormGroup>
+                <CreateCollectionPropertiesForm />
+                <CreateCollectionPropertiesList />
+            </FormGroup>
+        </div>
+        <CollectionStorageClassesField defaultClasses={['default']} />
+        <Field
+            name='files'
+            label='Files'
+            component={FileUploaderField} />
+    </span>);