Remove default export
[arvados-workbench2.git] / src / views-components / dialog-create / dialog-project-create.tsx
index 8c690c09f0be23e413ac7de03349b184447c379d..e11c67af75ecfca9ea49a08a7c9d7d558d617e81 100644 (file)
@@ -64,64 +64,65 @@ interface TextFieldProps {
     meta?: any;
 }
 
-class DialogProjectCreate extends React.Component<DialogProjectProps & WithStyles<CssRules>> {
-    render() {
-        const { classes, open, handleClose, handleSubmit, onSubmit, submitting } = this.props;
-
-        return (
-            <Dialog
-                open={open}
-                onClose={handleClose}
-                disableBackdropClick={true}
-                disableEscapeKeyDown={true}>
-                <div className={classes.dialog}>
-                    <form onSubmit={handleSubmit((data: any) => onSubmit(data))}>
-                        <DialogTitle id="form-dialog-title" className={classes.dialogTitle}>Create a project</DialogTitle>
-                        <DialogContent className={classes.formContainer}>
-                            <Field name="name"
-                                component={this.renderTextField}
-                                floatinglabeltext="Project Name"
-                                validate={NAME}
-                                className={classes.textField}
-                                label="Project Name" />
-                            <Field name="description"
-                                component={this.renderTextField}
-                                floatinglabeltext="Description - optional"
-                                validate={DESCRIPTION}
-                                className={classes.textField}
-                                label="Description - optional" />
-                        </DialogContent>
-                        <DialogActions className={classes.dialogActions}>
-                            <Button onClick={handleClose} className={classes.button} color="primary" disabled={submitting}>CANCEL</Button>
-                            <Button type="submit"
-                                className={classes.lastButton}
-                                color="primary"
-                                disabled={submitting}
-                                variant="contained">
-                                CREATE A PROJECT
-                            </Button>
-                            {submitting && <CircularProgress size={20} className={classes.createProgress} />}
-                        </DialogActions>
-                    </form>
-                </div>
-            </Dialog>
-        );
-    }
+export const DialogProjectCreate = compose(
+    reduxForm({ form: 'projectCreateDialog' }),
+    withStyles(styles))(
+    class DialogProjectCreate extends React.Component<DialogProjectProps & WithStyles<CssRules>> {
+        render() {
+            const { classes, open, handleClose, handleSubmit, onSubmit, submitting } = this.props;
 
-    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}
-        />
-    )
-}
+            return (
+                <Dialog
+                    open={open}
+                    onClose={handleClose}
+                    disableBackdropClick={true}
+                    disableEscapeKeyDown={true}>
+                    <div className={classes.dialog}>
+                        <form onSubmit={handleSubmit((data: any) => onSubmit(data))}>
+                            <DialogTitle id="form-dialog-title" className={classes.dialogTitle}>Create a
+                                project</DialogTitle>
+                            <DialogContent className={classes.formContainer}>
+                                <Field name="name"
+                                       component={this.renderTextField}
+                                       floatinglabeltext="Project Name"
+                                       validate={NAME}
+                                       className={classes.textField}
+                                       label="Project Name"/>
+                                <Field name="description"
+                                       component={this.renderTextField}
+                                       floatinglabeltext="Description - optional"
+                                       validate={DESCRIPTION}
+                                       className={classes.textField}
+                                       label="Description - optional"/>
+                            </DialogContent>
+                            <DialogActions className={classes.dialogActions}>
+                                <Button onClick={handleClose} className={classes.button} color="primary"
+                                        disabled={submitting}>CANCEL</Button>
+                                <Button type="submit"
+                                        className={classes.lastButton}
+                                        color="primary"
+                                        disabled={submitting}
+                                        variant="contained">
+                                    CREATE A PROJECT
+                                </Button>
+                                {submitting && <CircularProgress size={20} className={classes.createProgress}/>}
+                            </DialogActions>
+                        </form>
+                    </div>
+                </Dialog>
+            );
+        }
 
-export default compose(
-    reduxForm({ form: 'projectCreateDialog' }),
-    withStyles(styles)
-)(DialogProjectCreate);
+        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}
+            />
+        )
+    }
+);