@@ -14,35 +14,34 @@ import { makeStyles } from '@material-ui/core/styles';
14
14
15
15
const useStyles = makeStyles ( {
16
16
inputField : {
17
- marginRight : '10px ' ,
18
- borderColor : 'white '
17
+ marginRight : '15px ' ,
18
+ // width : '245px '
19
19
} ,
20
20
inputWrapper : {
21
- height : '120px ' ,
21
+ height : '110px ' ,
22
22
textAlign : 'center' ,
23
23
display : 'flex' ,
24
- justifyContent : 'space-evenly '
24
+ justifyContent : 'flex-end '
25
25
} ,
26
26
panelWrapper : {
27
27
marginTop : '35px' ,
28
28
width : '100%'
29
29
} ,
30
30
panelWrapperList : {
31
- height : '850px' ,
32
- overflowY : 'scroll'
31
+ height : '675px' ,
32
+ overflowY : 'auto' ,
33
+ marginLeft : '-15px'
33
34
} ,
34
35
input : {
35
36
color : '#fff' ,
36
- marginBottom : '10px' ,
37
37
borderRadius : '5px' ,
38
38
paddingLeft : '15px' ,
39
- paddingTop : '5px' ,
40
- paddingBottom : '5px' ,
41
39
paddingRight : '10px' ,
42
40
whiteSpace : 'nowrap' ,
43
41
overflowX : 'hidden' ,
44
42
textOverflow : 'ellipsis' ,
45
- border : '1px solid #33eb91'
43
+ border : '1px solid rgba(51,235,145,0.75)' ,
44
+ backgroundColor : 'rgba(255,255,255,0.15)'
46
45
} ,
47
46
inputLabel : {
48
47
fontSize : '14px' ,
@@ -52,7 +51,9 @@ const useStyles = makeStyles({
52
51
} ,
53
52
btnGroup : {
54
53
display : 'flex' ,
55
- flexDirection : 'column'
54
+ flexDirection : 'column' ,
55
+ paddingTop : '10px' ,
56
+ marginRight : '10px'
56
57
} ,
57
58
button : {
58
59
fontSize : '1rem'
@@ -62,41 +63,15 @@ const useStyles = makeStyles({
62
63
fontSize : '0.85rem'
63
64
} ,
64
65
compPanelItem : {
66
+ color : 'red' ,
65
67
'&:hover' : {
66
68
cursor : 'pointer' ,
67
69
backgroundColor : 'red'
68
70
}
69
- }
71
+ } ,
72
+
70
73
} ) ;
71
74
72
- const initialState : any = {
73
- components : [
74
- {
75
- id : 1 ,
76
- name : 'index' ,
77
- style : { } ,
78
- nextChildId : 1 ,
79
- children : [ ]
80
- } ,
81
- {
82
- id : 2 ,
83
- name : 'Article' ,
84
- style : { } ,
85
- nextChildId : 1 ,
86
- children : [ ]
87
- } ,
88
- {
89
- id : 3 ,
90
- name : 'Section' ,
91
- style : { } ,
92
- nextChildId : 1 ,
93
- children : [ ]
94
- }
95
- ] ,
96
- rootComponents : [ 1 ] ,
97
- canvasFocus : { componentId : 1 , childId : null } ,
98
- nextComponentId : 4
99
- } ;
100
75
101
76
const ComponentPanel = ( ) : JSX . Element => {
102
77
const classes = useStyles ( ) ;
@@ -173,20 +148,25 @@ const ComponentPanel = (): JSX.Element => {
173
148
resetError ( ) ;
174
149
} ;
175
150
176
- // const reportFocus = (targetId: Number) => {
177
- // const focusTarget = state.components.filter(comp => {
178
- // return comp.id === targetId;
179
- // });
180
- // console.log('FOCUSING ON COMPONENT: ');
181
- // console.log(focusTarget[0]);
182
- // };
151
+ const isFocus = ( targetId : Number ) => {
152
+ return state . canvasFocus . componentId === targetId ? true : false ;
153
+ }
154
+
155
+ const setFocus = ( targetId : Number ) => {
156
+ const focusTarget = state . components . filter ( comp => {
157
+ return comp . id === targetId ;
158
+ } ) ;
159
+ //placeholder for switching focus
160
+ console . log ( 'FOCUSING ON COMPONENT: ' ) ;
161
+ console . log ( focusTarget [ 0 ] ) ;
162
+ } ;
183
163
184
164
return (
185
165
< div className = { classes . panelWrapper } >
186
166
< div className = { classes . inputWrapper } >
187
167
< TextField
188
168
color = { 'primary' }
189
- label = "COMPONENT NAME "
169
+ label = "Component Name "
190
170
variant = "outlined"
191
171
className = { classes . inputField }
192
172
InputProps = { { className : classes . input } }
@@ -202,9 +182,9 @@ const ComponentPanel = (): JSX.Element => {
202
182
color = "primary"
203
183
onClick = { handleNameSubmit }
204
184
>
205
- CREATE
185
+ ADD
206
186
</ Button >
207
- < FormControlLabel
187
+ { /* <FormControlLabel
208
188
control={
209
189
<Switch
210
190
checked={isRoot}
@@ -214,19 +194,19 @@ const ComponentPanel = (): JSX.Element => {
214
194
}
215
195
className={classes.rootToggle}
216
196
label="ROOT"
217
- />
197
+ /> */ }
218
198
</ div >
219
199
</ div >
220
200
< div className = { classes . panelWrapperList } >
221
201
< Grid container direction = "row" justify = "center" alignItems = "center" >
222
202
{ state . components . map ( comp => (
223
203
< ComponentPanelItem
224
- className = { classes . compPanelItem }
204
+ isFocus = { isFocus ( comp . id ) }
225
205
key = { `comp-${ comp . id } ` }
226
206
name = { comp . name }
227
207
id = { comp . id }
228
208
root = { state . rootComponents . includes ( comp . id ) }
229
- focusClick = { ( ) => reportFocus ( comp . id ) }
209
+ focusClick = { ( ) => setFocus ( comp . id ) }
230
210
/>
231
211
) ) }
232
212
</ Grid >
0 commit comments