18219: Improves edit & create dialogs adding some separation between fields.
authorLucas Di Pentima <lucas.dipentima@curii.com>
Tue, 4 Jan 2022 14:56:02 +0000 (11:56 -0300)
committerLucas Di Pentima <lucas.dipentima@curii.com>
Tue, 4 Jan 2022 14:56:02 +0000 (11:56 -0300)
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas.dipentima@curii.com>

src/views-components/collection-properties/create-collection-properties-form.tsx
src/views-components/collection-properties/update-collection-properties-form.tsx
src/views-components/dialog-create/dialog-collection-create.tsx
src/views-components/dialog-create/dialog-project-create.tsx
src/views-components/dialog-update/dialog-collection-update.tsx
src/views-components/dialog-update/dialog-project-update.tsx
src/views-components/project-properties/create-project-properties-form.tsx
src/views-components/project-properties/update-project-properties-form.tsx

index ab389ddcc4c5731fd0c2c6c3c5c8746b66293e37..3f19e158595ca84e6f109d448184d41f76c66850 100644 (file)
@@ -18,7 +18,6 @@ const Form = withStyles(
     ({ spacing }) => (
         { container:
             {
-                paddingTop: spacing.unit,
                 margin: 0,
             }
         })
index 940e318c3f8a808a970f888175a9498e64460d18..9092c7cce16396e05637858cff27f9877b90c02c 100644 (file)
@@ -18,7 +18,6 @@ const Form = withStyles(
     ({ spacing }) => (
         { container:
             {
-                paddingTop: spacing.unit,
                 margin: 0,
             }
         })
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>);
 
index 65da87d3799fd8e7bf3475cbbf0fcf9aaad25faa..d85a304e006aa7193a4a1fa036d41127b95e05e2 100644 (file)
@@ -10,10 +10,23 @@ import { FormDialog } from 'components/form-dialog/form-dialog';
 import { ProjectNameField, ProjectDescriptionField, UsersField } from 'views-components/form-fields/project-form-fields';
 import { CreateProjectPropertiesForm } from 'views-components/project-properties/create-project-properties-form';
 import { ResourceParentField } from '../form-fields/resource-form-fields';
-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';
 import { GroupClass } from 'models/group';
 
+type CssRules = 'propertiesForm' | 'description';
+
+const styles: StyleRulesCallback<CssRules> = theme => ({
+    propertiesForm: {
+        marginTop: theme.spacing.unit * 2,
+        marginBottom: theme.spacing.unit * 2,
+    },
+    description: {
+        marginTop: theme.spacing.unit * 2,
+        marginBottom: theme.spacing.unit * 2,
+    },
+});
+
 type DialogProjectProps = WithDialogProps<{sourcePanel: GroupClass}> & InjectedFormProps<ProjectCreateFormDialogData>;
 
 export const DialogProjectCreate = (props: DialogProjectProps) => {
@@ -28,7 +41,7 @@ export const DialogProjectCreate = (props: DialogProjectProps) => {
 
     return <FormDialog
         dialogTitle={title}
-        formFields={fields}
+        formFields={fields as any}
         submitLabel='Create'
         {...props}
     />;
@@ -36,24 +49,34 @@ export const DialogProjectCreate = (props: DialogProjectProps) => {
 
 const CreateProjectPropertiesList = resourcePropertiesList(PROJECT_CREATE_FORM_NAME);
 
-const ProjectAddFields = () => <span>
-    <ResourceParentField />
-    <ProjectNameField />
-    <ProjectDescriptionField />
-    <FormLabel>Properties</FormLabel>
-    <FormGroup>
-        <CreateProjectPropertiesForm />
-        <CreateProjectPropertiesList />
-    </FormGroup>
-</span>;
-
-const GroupAddFields = () => <span>
-    <ProjectNameField />
-    <UsersField />
-    <ProjectDescriptionField />
-    <FormLabel>Properties</FormLabel>
-    <FormGroup>
-        <CreateProjectPropertiesForm />
-        <CreateProjectPropertiesList />
-    </FormGroup>
-</span>;
+const ProjectAddFields = withStyles(styles)(
+    ({ classes }: WithStyles<CssRules>) => <span>
+        <ResourceParentField />
+        <ProjectNameField />
+        <div className={classes.description}>
+            <ProjectDescriptionField />
+        </div>
+        <div className={classes.propertiesForm}>
+            <FormLabel>Properties</FormLabel>
+            <FormGroup>
+                <CreateProjectPropertiesForm />
+                <CreateProjectPropertiesList />
+            </FormGroup>
+        </div>
+    </span>);
+
+const GroupAddFields = withStyles(styles)(
+    ({ classes }: WithStyles<CssRules>) => <span>
+        <ProjectNameField />
+        <UsersField />
+        <div className={classes.description}>
+            <ProjectDescriptionField />
+        </div>
+        <div className={classes.propertiesForm}>
+            <FormLabel>Properties</FormLabel>
+            <FormGroup>
+                <CreateProjectPropertiesForm />
+                <CreateProjectPropertiesList />
+            </FormGroup>
+        </div>
+    </span>);
index 852dab1a354b874cb1273340f48b752342df3dc8..d77d10fff8279f13a1515bbeb1aaae0ac49dd297 100644 (file)
@@ -13,28 +13,40 @@ import {
     CollectionStorageClassesField
 } from 'views-components/form-fields/collection-form-fields';
 import { UpdateCollectionPropertiesForm } from 'views-components/collection-properties/update-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<CollectionUpdateFormDialogData>;
 
 export const DialogCollectionUpdate = (props: DialogCollectionProps) =>
     <FormDialog
         dialogTitle='Edit Collection'
-        formFields={CollectionEditFields}
+        formFields={CollectionEditFields as any}
         submitLabel='Save'
         {...props}
     />;
 
 const UpdateCollectionPropertiesList = resourcePropertiesList(COLLECTION_UPDATE_FORM_NAME);
 
-const CollectionEditFields = () => <span>
-    <CollectionNameField />
-    <CollectionDescriptionField />
-    <FormLabel>Properties</FormLabel>
-    <FormGroup>
-        <UpdateCollectionPropertiesForm />
-        <UpdateCollectionPropertiesList />
-    </FormGroup>
-    <CollectionStorageClassesField />
-</span>;
+const CollectionEditFields = withStyles(styles)(
+    ({ classes }: WithStyles<CssRules>) => <span>
+        <CollectionNameField />
+        <CollectionDescriptionField />
+        <div className={classes.propertiesForm}>
+            <FormLabel>Properties</FormLabel>
+            <FormGroup>
+                <UpdateCollectionPropertiesForm />
+                <UpdateCollectionPropertiesList />
+            </FormGroup>
+        </div>
+        <CollectionStorageClassesField />
+    </span>);
index bad01815659f5aac6b555edb1b20aeed3a70dce4..a6ac65b1944cc18fc835251fad268f11b5195b23 100644 (file)
@@ -9,10 +9,23 @@ import { ProjectUpdateFormDialogData, PROJECT_UPDATE_FORM_NAME } from 'store/pro
 import { FormDialog } from 'components/form-dialog/form-dialog';
 import { ProjectNameField, ProjectDescriptionField } from 'views-components/form-fields/project-form-fields';
 import { GroupClass } from 'models/group';
-import { FormGroup, FormLabel } from '@material-ui/core';
+import { FormGroup, FormLabel, StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core';
 import { UpdateProjectPropertiesForm } from 'views-components/project-properties/update-project-properties-form';
 import { resourcePropertiesList } from 'views-components/resource-properties/resource-properties-list';
 
+type CssRules = 'propertiesForm' | 'description';
+
+const styles: StyleRulesCallback<CssRules> = theme => ({
+    propertiesForm: {
+        marginTop: theme.spacing.unit * 2,
+        marginBottom: theme.spacing.unit * 2,
+    },
+    description: {
+        marginTop: theme.spacing.unit * 2,
+        marginBottom: theme.spacing.unit * 2,
+    },
+});
+
 type DialogProjectProps = WithDialogProps<{sourcePanel: GroupClass}> & InjectedFormProps<ProjectUpdateFormDialogData>;
 
 export const DialogProjectUpdate = (props: DialogProjectProps) => {
@@ -25,7 +38,7 @@ export const DialogProjectUpdate = (props: DialogProjectProps) => {
 
     return <FormDialog
         dialogTitle={title}
-        formFields={ProjectEditFields}
+        formFields={ProjectEditFields as any}
         submitLabel='Save'
         {...props}
     />;
@@ -34,12 +47,17 @@ export const DialogProjectUpdate = (props: DialogProjectProps) => {
 const UpdateProjectPropertiesList = resourcePropertiesList(PROJECT_UPDATE_FORM_NAME);
 
 // Also used as "Group Edit Fields"
-const ProjectEditFields = () => <span>
-    <ProjectNameField />
-    <ProjectDescriptionField />
-    <FormLabel>Properties</FormLabel>
-    <FormGroup>
-        <UpdateProjectPropertiesForm />
-        <UpdateProjectPropertiesList />
-    </FormGroup>
-</span>;
+const ProjectEditFields = withStyles(styles)(
+    ({ classes }: WithStyles<CssRules>) => <span>
+        <ProjectNameField />
+        <div className={classes.description}>
+            <ProjectDescriptionField />
+        </div>
+        <div className={classes.propertiesForm}>
+            <FormLabel>Properties</FormLabel>
+            <FormGroup>
+                <UpdateProjectPropertiesForm />
+                <UpdateProjectPropertiesList />
+            </FormGroup>
+        </div>
+    </span>);
index aa9965b55e4ea452cd71cb72779a834267bbed24..8c26523e8e79327ef0f53ac1bbe829e765031e20 100644 (file)
@@ -18,7 +18,6 @@ const Form = withStyles(
     ({ spacing }) => (
         { container:
             {
-                paddingTop: spacing.unit,
                 margin: 0,
             }
         })
index e6151229660e8573dee6854282d25d671efa4382..0b5554bc52aedee200e9973031ff4fe5a39bf0b7 100644 (file)
@@ -18,7 +18,6 @@ const Form = withStyles(
     ({ spacing }) => (
         { container:
             {
-                paddingTop: spacing.unit,
                 margin: 0,
             }
         })