1
- import React , { Component } from " react" ;
2
- import { connect } from " react-redux" ;
3
- import { compose } from " redux" ;
4
- import FormControl from " @material-ui/core/FormControl" ;
5
- import TextField from " @material-ui/core/TextField" ;
6
- import Button from " @material-ui/core/Button" ;
7
- import AddIcon from " @material-ui/icons/Add" ;
8
- import Grid from " @material-ui/core/Grid" ;
9
- import { withStyles } from " @material-ui/core/styles" ;
10
- import LeftColExpansionPanel from " ../components/LeftColExpansionPanel.jsx" ;
11
- import HTMLComponentPanel from " ../components/HTMLComponentPanel.jsx" ;
12
- import * as actions from " ../actions/components" ;
1
+ import React , { Component } from ' react' ;
2
+ import { connect } from ' react-redux' ;
3
+ import { compose } from ' redux' ;
4
+ import FormControl from ' @material-ui/core/FormControl' ;
5
+ import TextField from ' @material-ui/core/TextField' ;
6
+ import Button from ' @material-ui/core/Button' ;
7
+ import AddIcon from ' @material-ui/icons/Add' ;
8
+ import Grid from ' @material-ui/core/Grid' ;
9
+ import { withStyles } from ' @material-ui/core/styles' ;
10
+ import LeftColExpansionPanel from ' ../components/LeftColExpansionPanel.jsx' ;
11
+ import HTMLComponentPanel from ' ../components/HTMLComponentPanel.jsx' ;
12
+ import * as actions from ' ../actions/components' ;
13
13
14
14
const mapDispatchToProps = dispatch => ( {
15
15
addComponent : ( { title } ) => dispatch ( actions . addComponent ( { title } ) ) ,
16
16
updateComponent : ( {
17
- id,
18
- index,
19
- newParentId = null ,
20
- color = null ,
21
- stateful = null
22
- } ) =>
23
- dispatch (
24
- actions . updateComponent ( {
25
- id,
26
- index,
27
- newParentId,
28
- color,
29
- stateful
30
- } )
31
- ) ,
32
- addChild : ( { title, childType, HTMLInfo } ) =>
33
- dispatch ( actions . addChild ( { title, childType, HTMLInfo } ) ) ,
34
- changeFocusComponent : ( { title } ) =>
35
- dispatch ( actions . changeFocusComponent ( { title } ) ) ,
36
- changeFocusChild : ( { title, childId } ) =>
37
- dispatch ( actions . changeFocusChild ( { title, childId } ) ) ,
38
- deleteComponent : ( { componentId, stateComponents } ) =>
39
- dispatch ( actions . deleteComponent ( { componentId, stateComponents } ) )
17
+ id, index, newParentId = null , color = null , stateful = null ,
18
+ } ) => dispatch (
19
+ actions . updateComponent ( {
20
+ id,
21
+ index,
22
+ newParentId,
23
+ color,
24
+ stateful,
25
+ } ) ,
26
+ ) ,
27
+ addChild : ( { title, childType, HTMLInfo } ) => dispatch ( actions . addChild ( { title, childType, HTMLInfo } ) ) ,
28
+ changeFocusComponent : ( { title } ) => dispatch ( actions . changeFocusComponent ( { title } ) ) ,
29
+ changeFocusChild : ( { childId } ) => dispatch ( actions . changeFocusChild ( { childId } ) ) ,
30
+ deleteComponent : ( { componentId, stateComponents } ) => dispatch ( actions . deleteComponent ( { componentId, stateComponents } ) ) ,
40
31
} ) ;
41
32
42
33
class LeftContainer extends Component {
43
34
state = {
44
- componentName : ""
35
+ componentName : '' ,
45
36
} ;
46
37
47
- handleChange = event => {
38
+ handleChange = ( event ) => {
48
39
this . setState ( {
49
- [ event . target . name ] : event . target . value
40
+ [ event . target . name ] : event . target . value ,
50
41
} ) ;
51
42
} ;
52
43
53
44
handleAddComponent = ( ) => {
54
45
this . props . addComponent ( { title : this . state . componentName } ) ;
55
46
this . setState ( {
56
- componentName : ""
47
+ componentName : '' ,
57
48
} ) ;
58
49
} ;
59
50
@@ -68,7 +59,7 @@ class LeftContainer extends Component {
68
59
addChild,
69
60
changeFocusComponent,
70
61
changeFocusChild,
71
- selectableChildren
62
+ selectableChildren,
72
63
} = this . props ;
73
64
const { componentName } = this . state ;
74
65
@@ -101,8 +92,8 @@ class LeftContainer extends Component {
101
92
margin = "normal"
102
93
autoFocus
103
94
onChange = { this . handleChange }
104
- onKeyPress = { ev => {
105
- if ( ev . key === " Enter" ) {
95
+ onKeyPress = { ( ev ) => {
96
+ if ( ev . key === ' Enter' ) {
106
97
// Do code here
107
98
this . handleAddComponent ( ) ;
108
99
ev . preventDefault ( ) ;
@@ -112,10 +103,10 @@ class LeftContainer extends Component {
112
103
name = "componentName"
113
104
className = { classes . light }
114
105
InputProps = { {
115
- className : classes . input
106
+ className : classes . input ,
116
107
} }
117
108
InputLabelProps = { {
118
- className : classes . input
109
+ className : classes . input ,
119
110
} }
120
111
/>
121
112
</ Grid >
@@ -151,48 +142,48 @@ function styles() {
151
142
// height: "200px"
152
143
// },
153
144
cssLabel : {
154
- color : " white" ,
145
+ color : ' white' ,
155
146
156
- " &$cssFocused" : {
157
- color : " green"
158
- }
147
+ ' &$cssFocused' : {
148
+ color : ' green' ,
149
+ } ,
159
150
} ,
160
151
cssFocused : { } ,
161
152
input : {
162
- color : " #fff" ,
163
- opacity : " 0.7" ,
164
- marginBottom : " 10px"
153
+ color : ' #fff' ,
154
+ opacity : ' 0.7' ,
155
+ marginBottom : ' 10px' ,
165
156
} ,
166
157
underline : {
167
- color : " white" ,
168
- " &::before" : {
169
- color : " white"
170
- }
158
+ color : ' white' ,
159
+ ' &::before' : {
160
+ color : ' white' ,
161
+ } ,
171
162
} ,
172
163
button : {
173
- color : " #fff" ,
164
+ color : ' #fff' ,
174
165
175
- " &:disabled" : {
176
- color : " grey"
177
- }
166
+ ' &:disabled' : {
167
+ color : ' grey' ,
168
+ } ,
178
169
} ,
179
170
clearButton : {
180
- top : " 96%" ,
181
- position : " sticky!important" ,
182
- zIndex : "1" ,
171
+ top : ' 96%' ,
172
+ position : ' sticky!important' ,
173
+ zIndex : '1' ,
183
174
184
- " &:disabled" : {
185
- color : " grey" ,
186
- backgroundColor : " #424242"
187
- }
188
- }
175
+ ' &:disabled' : {
176
+ color : ' grey' ,
177
+ backgroundColor : ' #424242' ,
178
+ } ,
179
+ } ,
189
180
} ;
190
181
}
191
182
192
183
export default compose (
193
184
withStyles ( styles ) ,
194
185
connect (
195
186
null ,
196
- mapDispatchToProps
197
- )
187
+ mapDispatchToProps ,
188
+ ) ,
198
189
) ( LeftContainer ) ;
0 commit comments