interface ProjectCreateProps {
open: boolean;
handleClose: () => void;
+ onSubmit: (data: { name: string, description: string }) => void;
}
interface DialogState {
state: DialogState = {
name: '',
description: '',
- isNameValid: true,
+ isNameValid: false,
isDescriptionValid: true
};
error={hasError}
fullWidth />} />
</DialogContent>
- <DialogActions className={classes.dialogActions}>
+ <DialogActions>
<Button onClick={handleClose} className={classes.button} color="primary">CANCEL</Button>
- <Button onClick={handleClose} className={classes.lastButton} color="primary" disabled={!this.state.isNameValid || (!this.state.isDescriptionValid && description.length > 0)} variant="raised">CREATE A PROJECT</Button>
+ <Button onClick={this.handleSubmit} className={classes.lastButton} color="primary" disabled={!this.state.isNameValid || (!this.state.isDescriptionValid && description.length > 0)} variant="raised">CREATE A PROJECT</Button>
</DialogActions>
</div>
</Dialog>
);
}
+ handleSubmit = () => {
+ this.props.onSubmit({
+ name: this.state.name,
+ description: this.state.description
+ });
+ }
+
handleProjectName(e: any) {
this.setState({
name: e.target.value,
}
}
-type CssRules = "button" | "lastButton" | "dialogContent" | "textField" | "dialog" | "dialogTitle" | "dialogActions";
+type CssRules = "button" | "lastButton" | "dialogContent" | "textField" | "dialog" | "dialogTitle";
const styles: StyleRulesCallback<CssRules> = theme => ({
button: {
dialogTitle: {
paddingBottom: "0"
},
- dialogActions: {
- marginBottom: "5px"
- },
textField: {
marginTop: "32px",
},