1
1
import React from "react" ;
2
2
import PropTypes from "prop-types" ;
3
3
import { withStyles , createStyles } from "@material-ui/core/styles" ;
4
+ import Paper from "@material-ui/core/Paper" ;
4
5
import Typography from "@material-ui/core/Typography" ;
5
6
import TextField from "@material-ui/core/TextField" ;
6
7
import InputLabel from "@material-ui/core/InputLabel" ;
@@ -9,6 +10,7 @@ import MenuItem from "@material-ui/core/MenuItem";
9
10
import Divider from "@material-ui/core/Divider" ;
10
11
import LoadIcon from "@material-ui/icons/Unarchive" ;
11
12
import SaveIcon from "@material-ui/icons/Save" ;
13
+ import ColorPicker from "./ColorPicker" ;
12
14
import SubmitButton from "./SubmitButton" ;
13
15
import styleOptions from "../utils/styleOptions" ;
14
16
import PrefPropType from "../utils/prefPropType" ;
@@ -27,7 +29,7 @@ class PreferenceForm extends React.Component {
27
29
const { preferences, justSaved, justLoaded, classes } = this . props ;
28
30
29
31
return (
30
- < div className = { classes . root } >
32
+ < Paper className = { classes . root } >
31
33
< Typography variant = "h5" className = { classes . header } >
32
34
Settings
33
35
</ Typography >
@@ -49,12 +51,36 @@ class PreferenceForm extends React.Component {
49
51
< Divider className = { classes . divider } />
50
52
< form onSubmit = { this . props . onSave } >
51
53
< TextField
52
- label = "username "
54
+ label = "Username "
53
55
value = { preferences . username }
54
56
onChange = { this . handlePrefChange ( "username" ) }
55
57
fullWidth
56
58
className = { classes . input }
57
59
/>
60
+ < InputLabel shrink > Primary Color</ InputLabel >
61
+ < ColorPicker
62
+ value = { preferences . primaryColor }
63
+ onChange = { this . handlePrefChange ( "primaryColor" ) }
64
+ />
65
+ < InputLabel shrink > Secondary Color</ InputLabel >
66
+ < ColorPicker
67
+ value = { preferences . secondaryColor }
68
+ onChange = { this . handlePrefChange ( "secondaryColor" ) }
69
+ />
70
+ < InputLabel shrink > Theme</ InputLabel >
71
+ < Select
72
+ value = { preferences . theme }
73
+ onChange = { this . handlePrefChange ( "theme" ) }
74
+ fullWidth
75
+ className = { classes . input }
76
+ >
77
+ < MenuItem key = "light" value = "light" >
78
+ light
79
+ </ MenuItem >
80
+ < MenuItem key = "dark" value = "dark" >
81
+ dark
82
+ </ MenuItem >
83
+ </ Select >
58
84
< InputLabel shrink > Code Style</ InputLabel >
59
85
< Select
60
86
value = { preferences . codeStyle }
@@ -75,7 +101,7 @@ class PreferenceForm extends React.Component {
75
101
submitted = { justSaved }
76
102
/>
77
103
</ form >
78
- </ div >
104
+ </ Paper >
79
105
) ;
80
106
}
81
107
}
@@ -95,6 +121,7 @@ PreferenceForm.propTypes = {
95
121
const styles = theme =>
96
122
createStyles ( {
97
123
root : {
124
+ padding : theme . spacing ( 4 ) ,
98
125
width : "100%"
99
126
} ,
100
127
header : {
@@ -103,11 +130,11 @@ const styles = theme =>
103
130
marginBottom : theme . spacing ( 2 )
104
131
} ,
105
132
divider : {
106
- marginTop : 32 ,
107
- marginBottom : 32
133
+ marginTop : theme . spacing ( 4 ) ,
134
+ marginBottom : theme . spacing ( 4 )
108
135
} ,
109
136
input : {
110
- marginBottom : 16 ,
137
+ marginBottom : theme . spacing ( 2 ) ,
111
138
width : "100%" ,
112
139
display : "block"
113
140
}
0 commit comments