@@ -13,7 +13,6 @@ import Tooltip from '@material-ui/core/Tooltip';
13
13
import Collapse from '@material-ui/core/Collapse' ;
14
14
import Switch from '@material-ui/core/Switch' ; // for state/class toggling
15
15
import InputLabel from '@material-ui/core/InputLabel' ; // labeling of state/class toggles
16
-
17
16
import { ComponentInt , ComponentsInt , PropsInt } from '../utils/Interfaces' ; // unused
18
17
interface LeftColExpPanPropsInt extends PropsInt {
19
18
classes : any ;
@@ -29,12 +28,10 @@ interface LeftColExpPanPropsInt extends PropsInt {
29
28
toggleComponentState ( arg : number ) : void ;
30
29
toggleComponentClass ( arg : number ) : void ;
31
30
}
32
-
33
31
//interface created but never used
34
32
// interface TypographyProps {
35
33
// type: string;
36
34
// }
37
-
38
35
// TODO: ASSIGN SPECIFIC TYPING TO INCOMING PROPS (REMOVE ANY)
39
36
const LeftColExpansionPanel = ( props : LeftColExpPanPropsInt ) => {
40
37
const {
@@ -49,24 +46,21 @@ const LeftColExpansionPanel = (props: LeftColExpPanPropsInt) => {
49
46
toggleComponentState,
50
47
toggleComponentClass
51
48
} = props ;
52
-
53
49
const { title, id, color, stateful, classBased } = component ;
54
-
55
50
function isFocused ( ) {
56
51
return focusComponent . id === id ? 'focused' : '' ;
57
52
}
58
-
59
53
// boolean flag to determine if the component card is focused or not
60
54
// state/class toggles will be displayed when a component is focused
61
55
const focusedToggle = isFocused ( ) === 'focused' ? true : false ;
62
-
63
56
return (
64
57
< Grid
65
58
container
66
59
spacing = { 16 }
67
60
direction = 'row'
68
- justify = 'flex-start '
61
+ justify = 'center '
69
62
alignItems = 'center'
63
+ style = { { minWidth : '320px' } }
70
64
>
71
65
< Grid item xs = { 9 } >
72
66
< div
@@ -89,7 +83,8 @@ const LeftColExpansionPanel = (props: LeftColExpPanPropsInt) => {
89
83
style = { {
90
84
color : 'red' ,
91
85
backgroundColor : color ,
92
- borderRadius : '10px'
86
+ borderRadius : '10px' ,
87
+ minWidth : '320px'
93
88
} }
94
89
>
95
90
< List style = { { color : 'red' } } >
@@ -115,49 +110,36 @@ const LeftColExpansionPanel = (props: LeftColExpPanPropsInt) => {
115
110
>
116
111
{ title }
117
112
</ Typography >
118
-
119
113
{ /* ALL OF THE STATE/CLASS TOGGLES AND LABELS ARE ONLY RENDERED IF THEIR COMPONENT IS THE FOCUSED COMPONENT
120
-
121
114
TO DO : IMPROVE DRYNESS OF CODE BY RENDERING ALL FOUR MATERIAL ELEMENTS (LABELS/SWITCH) IN ONE CONDITIONAL
122
115
*/ }
123
-
124
116
{ /* LABEL AND TOGGLE(SWITCH) FOR STATEFULNESS */ }
125
117
{ focusedToggle ? (
126
- < InputLabel
127
- htmlFor = 'stateful'
128
- style = { {
129
- color : '#fff' ,
130
- marginBottom : '10px' ,
131
- marginTop : '0px' ,
132
- marginLeft : '11px' ,
133
- padding : '0px' ,
134
- fontSize : '18px' ,
135
- textShadow : '1px 1px 2px rgba(0, 0, 0, 0.7)'
136
- } }
137
- >
138
- State?
139
- </ InputLabel >
140
- ) : (
141
- ''
142
- ) }
143
-
144
- { focusedToggle ? (
145
- < Switch
146
- checked = { stateful }
147
- onChange = { e => {
148
- toggleComponentState ( id ) ;
149
- changeFocusComponent ( { title } ) ;
150
- } }
151
- value = 'stateful'
152
- color = 'primary'
153
- // id={props.id.toString()}
154
- />
155
- ) : (
156
- ''
157
- ) }
158
- < div >
159
- { /* LABEL/TOGGLE(SWITCH) FOR CLASS BASED */ }
160
- { focusedToggle ? (
118
+ < span style = { { display : 'inline-flex' } } >
119
+ < InputLabel
120
+ htmlFor = 'stateful'
121
+ style = { {
122
+ color : '#fff' ,
123
+ marginBottom : '10px' ,
124
+ marginTop : '0px' ,
125
+ marginLeft : '11px' ,
126
+ padding : '0px' ,
127
+ fontSize : '18px' ,
128
+ textShadow : '1px 1px 2px rgba(0, 0, 0, 0.7)'
129
+ } }
130
+ >
131
+ State?
132
+ </ InputLabel >
133
+ < Switch
134
+ checked = { stateful }
135
+ onChange = { e => {
136
+ toggleComponentState ( id ) ;
137
+ changeFocusComponent ( { title } ) ;
138
+ } }
139
+ value = 'stateful'
140
+ color = 'primary'
141
+ // id={props.id.toString()}
142
+ />
161
143
< InputLabel
162
144
htmlFor = 'classBased'
163
145
style = { {
@@ -171,11 +153,8 @@ const LeftColExpansionPanel = (props: LeftColExpPanPropsInt) => {
171
153
} }
172
154
>
173
155
Class?
174
- </ InputLabel >
175
- ) : (
176
- ''
177
- ) }
178
- { focusedToggle ? (
156
+ </ InputLabel > { ' ' }
157
+ (
179
158
< Switch
180
159
checked = { classBased }
181
160
onChange = { e => {
@@ -185,48 +164,48 @@ const LeftColExpansionPanel = (props: LeftColExpPanPropsInt) => {
185
164
value = 'classBased'
186
165
color = 'primary'
187
166
/>
188
- ) : (
189
- ''
190
- ) }
191
- { focusedToggle && component . id !== 1 ? (
192
- < Button
193
- variant = 'text'
194
- size = 'small'
195
- color = 'default'
196
- aria-label = 'Delete'
197
- className = { classes . margin }
198
- onClick = { ( ) =>
199
- deleteComponent ( {
200
- componentId : id ,
201
- stateComponents : components
202
- } )
203
- }
167
+ </ span >
168
+ ) : (
169
+ ''
170
+ ) }
171
+ { focusedToggle && component . id !== 1 ? (
172
+ < Button
173
+ variant = 'text'
174
+ size = 'small'
175
+ color = 'default'
176
+ aria-label = 'Delete'
177
+ className = { classes . margin }
178
+ onClick = { ( ) =>
179
+ deleteComponent ( {
180
+ componentId : id ,
181
+ stateComponents : components
182
+ } )
183
+ }
184
+ style = { {
185
+ color : 'white' ,
186
+ marginBottom : '0px' ,
187
+ marginTop : '4px'
188
+ } }
189
+ >
190
+ < DeleteIcon
191
+ style = { {
192
+ color : '#b30000' ,
193
+ textShadow : '1px 1px 2px rgba(0, 0, 0, 0.5)'
194
+ } }
195
+ />
196
+ < div
204
197
style = { {
205
- color : 'white ' ,
206
- marginBottom : '0px ' ,
207
- marginTop : '4px '
198
+ marginTop : '3px ' ,
199
+ fontSize : '15px ' ,
200
+ textShadow : '1px 1px 2px rgba(0, 0, 0, 0.8) '
208
201
} }
209
202
>
210
- < DeleteIcon
211
- style = { {
212
- color : '#b30000' ,
213
- textShadow : '1px 1px 2px rgba(0, 0, 0, 0.5)'
214
- } }
215
- />
216
- < span
217
- style = { {
218
- marginTop : '3px' ,
219
- fontSize : '15px' ,
220
- textShadow : '1px 1px 2px rgba(0, 0, 0, 0.8)'
221
- } }
222
- >
223
- Delete Component
224
- </ span >
225
- </ Button >
226
- ) : (
227
- ''
228
- ) }
229
- </ div >
203
+ Delete Component
204
+ </ div >
205
+ </ Button >
206
+ ) : (
207
+ ''
208
+ ) }
230
209
</ div >
231
210
}
232
211
style = { { color } }
@@ -291,7 +270,6 @@ const LeftColExpansionPanel = (props: LeftColExpPanPropsInt) => {
291
270
</ Grid >
292
271
) ;
293
272
} ;
294
-
295
273
function styles ( ) : any {
296
274
return {
297
275
root : {
@@ -307,5 +285,4 @@ function styles(): any {
307
285
}
308
286
} ;
309
287
}
310
-
311
288
export default withStyles ( styles ) ( LeftColExpansionPanel ) ;
0 commit comments