@@ -19,6 +19,15 @@ const LargeTextField = styled(TextField)`
19
19
font-size: 20px;
20
20
}
21
21
` ;
22
+ const SmallTextField = styled ( TextField ) `
23
+ input {
24
+ height: 30px;
25
+ font-size: 20px;
26
+ }
27
+ ` ;
28
+ function refreshPage ( ) {
29
+ window . location . reload ( false ) ;
30
+ }
22
31
23
32
function CreateCourseDialog ( ) {
24
33
const [ open , setOpen ] = useState ( false ) ;
@@ -56,7 +65,7 @@ function CreateCourseDialog() {
56
65
initialValues = { {
57
66
courseTitle : '' ,
58
67
courseDescription : '' ,
59
- instructor : 'currentUser ' ,
68
+ courseInstructor : '' ,
60
69
} }
61
70
onSubmit = { ( values , { setSubmitting } ) => {
62
71
setTimeout ( ( ) => {
@@ -65,10 +74,10 @@ function CreateCourseDialog() {
65
74
addCourse ( {
66
75
variables : {
67
76
course : {
68
- name : values . courseTitle ,
77
+ course : values . courseTitle ,
69
78
description : values . courseDescription ,
70
- instructor : 'Mr. Butcher' ,
71
- missions : [ ] ,
79
+ instructor : values . courseInstructor ,
80
+ // missions: [],
72
81
} ,
73
82
} ,
74
83
} ) . catch ( ( error ) => console . log ( error ) ) ;
@@ -77,7 +86,7 @@ function CreateCourseDialog() {
77
86
>
78
87
{ ( { values, handleChange, handleBlur, handleSubmit, isSubmitting } ) => (
79
88
< form onSubmit = { handleSubmit } >
80
- < LargeTextField
89
+ < SmallTextField
81
90
id = "courseTitle"
82
91
label = "Course Title"
83
92
type = "text"
@@ -100,12 +109,27 @@ function CreateCourseDialog() {
100
109
onChange = { handleChange }
101
110
onBlur = { handleBlur }
102
111
/>
103
-
112
+ < SmallTextField
113
+ id = "instructor"
114
+ label = "Instructor"
115
+ type = "text"
116
+ fullWidth
117
+ variant = "outlined"
118
+ margin = "dense"
119
+ value = { values . courseInstructor }
120
+ onChange = { handleChange }
121
+ onBlur = { handleBlur }
122
+ />
104
123
< DialogActions >
105
124
< Button onClick = { handleClose } color = "primary" >
106
125
Cancel
107
126
</ Button >
108
- < Button type = "submit" disabled = { isSubmitting } color = "primary" >
127
+ < Button
128
+ type = "submit"
129
+ onClick = { refreshPage }
130
+ disabled = { isSubmitting }
131
+ color = "primary"
132
+ >
109
133
Create
110
134
</ Button >
111
135
</ DialogActions >
0 commit comments