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