@@ -20,7 +20,7 @@ import DeleteIcon from '@mui/icons-material/Delete';
20
20
import InsertPhoto from '@mui/icons-material/InsertPhoto' ;
21
21
import MUIItem from './MUIItem' ;
22
22
import HTMLItem from './HTMLItem' ;
23
- import HTMLPanel from " ./HTMLPanel" ;
23
+ import HTMLPanel from ' ./HTMLPanel' ;
24
24
import ComponentDrag from './ComponentDrag' ;
25
25
26
26
/**
@@ -42,15 +42,15 @@ const CreateMenu = (props): JSX.Element => {
42
42
43
43
const [ menuAnchor , setMenuAnchor ] = React . useState < null | HTMLElement > ( null ) ;
44
44
const [ activeCategory , setActiveCategory ] = React . useState < string | null > (
45
- null ,
45
+ null
46
46
) ;
47
47
const [ menuLocked , setMenuLocked ] = useState ( false ) ;
48
48
49
49
const [ isCreatingModule , setCreateModule ] = useState ( false ) ;
50
50
const [ MUIMode , setMUIMode ] = useState ( false ) ;
51
51
const handleMenuOpen = (
52
52
event : React . MouseEvent < HTMLButtonElement > ,
53
- category : string ,
53
+ category : string
54
54
) => {
55
55
setActiveCategory ( category ) ;
56
56
setMenuAnchor ( event . currentTarget ) ;
@@ -81,24 +81,23 @@ const CreateMenu = (props): JSX.Element => {
81
81
if ( roomCode ) {
82
82
emitEvent ( 'deleteElementAction' , roomCode , {
83
83
id,
84
- contextParam,
84
+ contextParam
85
85
} ) ;
86
86
}
87
87
} ;
88
88
89
89
const handleClickAdd = ( ) => {
90
90
setCreateModule ( true ) ;
91
91
} ;
92
- // create a function to which you can pass in an array of strings, search
93
- // both state.HTMLTypes and state.MUITypes to see if any of their type.names match
94
- // an item in the array and return the item if so, depending on which list it originates from.
95
92
96
93
const handleKeyPress = ( event : React . KeyboardEvent < HTMLInputElement > ) => {
97
94
if ( event . key === 'Enter' ) {
98
95
handleClickAdd ( ) ;
99
96
}
100
97
} ;
101
-
98
+ // create a function to which you can pass in an array of strings, search
99
+ // both state.HTMLTypes and state.MUITypes to see if any of their type.names match
100
+ // an item in the array and return the item if so, depending on which list it originates from.
102
101
const findTypes = function ( array ) {
103
102
if ( MUIMode === true )
104
103
return state . HTMLTypes . filter ( ( type ) => array . includes ( type . name ) )
@@ -121,7 +120,7 @@ const CreateMenu = (props): JSX.Element => {
121
120
icon = { option . icon }
122
121
handleDelete = { handleDelete }
123
122
/>
124
- ) ,
123
+ )
125
124
)
126
125
) ;
127
126
else
@@ -134,7 +133,7 @@ const CreateMenu = (props): JSX.Element => {
134
133
icon = { option . icon }
135
134
handleDelete = { handleDelete }
136
135
/>
137
- ) ,
136
+ )
138
137
) ;
139
138
} ;
140
139
const HTMLElements = findTypes ( [
@@ -144,7 +143,7 @@ const CreateMenu = (props): JSX.Element => {
144
143
'Header 2' ,
145
144
'Span' ,
146
145
'Label' ,
147
- 'Link' ,
146
+ 'Link'
148
147
] ) ;
149
148
150
149
const InputElements = findTypes ( [ 'Input' , 'Form' , 'Button' ] ) ;
@@ -153,7 +152,7 @@ const CreateMenu = (props): JSX.Element => {
153
152
'Icon' ,
154
153
'Avatar' ,
155
154
'Badge' ,
156
- 'Img' ,
155
+ 'Img'
157
156
] ) ;
158
157
159
158
const textComponents = findTypes ( [
@@ -162,7 +161,7 @@ const CreateMenu = (props): JSX.Element => {
162
161
'Header 2' ,
163
162
'Span' ,
164
163
'Label' ,
165
- 'Link' ,
164
+ 'Link'
166
165
] ) ;
167
166
168
167
// create containers - box/container/stack
@@ -172,7 +171,7 @@ const CreateMenu = (props): JSX.Element => {
172
171
'Box' ,
173
172
'Container' ,
174
173
'Stack' ,
175
- 'Dividers' ,
174
+ 'Dividers'
176
175
] ) ;
177
176
178
177
// create buttons -- button/floating button/chips
@@ -188,25 +187,25 @@ const CreateMenu = (props): JSX.Element => {
188
187
'Checkbox' ,
189
188
'Switch' ,
190
189
'Rating' ,
191
- 'Slider' ,
190
+ 'Slider'
192
191
] ) ;
193
192
194
193
// create lists - OL, UL, LI, TransferList
195
194
196
- const lists = findTypes ( [ 'Ordered List' , 'Unordered List' , 'List' ] ) ;
195
+ const lists = findTypes ( [ 'Ordered List' , 'List' , 'Unordered List' ] ) ;
197
196
//create forms -- Form, ButtonGroup, ToggleButtonGroup, Select, AutoComplete
198
197
const HTMLlists = findTypes ( [
199
198
'Ordered List' ,
200
- 'Unordered List' ,
201
199
'List' ,
202
- 'Menu' ,
200
+ 'Unordered List' ,
201
+ 'Menu'
203
202
] ) ;
204
203
const forms = findTypes ( [
205
204
'Form' ,
206
205
'ButtonGroup' ,
207
206
'ToggleButtonGroup' ,
208
207
'Select' ,
209
- 'AutoComplete' ,
208
+ 'AutoComplete'
210
209
] ) ;
211
210
// create displays --- Modal, POpover, Popper, Transition
212
211
const displays = findTypes ( [ 'Modal' , 'Popover' , 'Popper' , 'Transition' ] ) ;
@@ -218,7 +217,7 @@ const CreateMenu = (props): JSX.Element => {
218
217
'AppBar' ,
219
218
'Tabs' ,
220
219
'Card' ,
221
- 'Paper' ,
220
+ 'Paper'
222
221
] ) ;
223
222
// create navigation -- menu, bottomnav, breadcrumbs, drawer, stepper, tabs, speeddial
224
223
const navComponents = findTypes ( [
@@ -227,7 +226,7 @@ const CreateMenu = (props): JSX.Element => {
227
226
'Breadcrumbs' ,
228
227
'Drawer' ,
229
228
'Stepper' ,
230
- 'Speed Dial' ,
229
+ 'Speed Dial'
231
230
] ) ;
232
231
233
232
const makeMenuCategory = function ( typeArray , name , idx ) {
@@ -236,14 +235,10 @@ const CreateMenu = (props): JSX.Element => {
236
235
< Box
237
236
sx = { {
238
237
fontSize : '2rem' ,
239
- textAlign : 'center' ,
238
+ textAlign : 'center'
240
239
} }
241
240
>
242
- < Button
243
- component = "label"
244
- id = { name + '-button' }
245
- key = { name + idx }
246
- >
241
+ < Button component = "label" id = { name + '-button' } key = { name + idx } >
247
242
{ name }
248
243
</ Button >
249
244
</ Box >
@@ -268,46 +263,40 @@ const CreateMenu = (props): JSX.Element => {
268
263
icon = { option . icon }
269
264
handleDelete = { handleDelete }
270
265
/>
271
- ) ) ,
266
+ ) )
272
267
] ) }
273
268
< FormGroup >
274
269
< Box display = "flex" alignItems = "center" justifyContent = "center" >
275
- < p style = { { fontSize : '0.8rem' } } > HTML</ p >
270
+ < p className = "smallerText blueText" > HTML</ p >
276
271
< Switch
277
272
checked = { MUIMode }
278
273
onChange = { ( ) => setMUIMode ( ! MUIMode ) }
279
274
inputProps = { { 'aria-label' : 'HTML + MUI switch' } }
280
275
sx = { { margin : '0 10px' } } // Adjust spacing between text and switch
281
276
/>
282
- < p style = { { fontSize : '0.8rem' } } > HTML + MUI</ p >
277
+ < p className = "smallerText" >
278
+ < span className = "blueText" > HTML + </ span >
279
+ < span className = "switchText-MUI orangeText" > MUI</ span >
280
+ </ p >
283
281
</ Box >
284
- { /* <FormControlLabel
285
- control={
286
- <Switch
287
- checked={MUIMode}
288
- onChange={() => MUIMode === true ? setMUIMode(false) : setMUIMode(true)}
289
- />
290
- }
291
- label={MUIMode ? 'HTML + MUI' : 'HTML'}
292
- /> */ }
293
282
</ FormGroup >
294
283
{ MUIMode
295
284
? [
296
- [ visualComponents , 'visual' ] ,
297
- [ containers , 'containers' ] ,
298
- [ buttons , 'buttons' ] ,
299
- [ textComponents , 'text' ] ,
300
- [ lists , 'lists' ] ,
301
- [ displays , 'displays' ] ,
302
- [ layouts , 'layouts' ] ,
303
- [ forms , 'forms' ] ,
304
- [ navComponents , 'navigation' ] ,
305
- ] . map ( ( item , idx ) => makeMenuCategory ( item [ 0 ] , item [ 1 ] , idx ) )
285
+ [ visualComponents , 'visual' ] ,
286
+ [ containers , 'containers' ] ,
287
+ [ buttons , 'buttons' ] ,
288
+ [ textComponents , 'text' ] ,
289
+ [ lists , 'lists' ] ,
290
+ [ displays , 'displays' ] ,
291
+ [ layouts , 'layouts' ] ,
292
+ [ forms , 'forms' ] ,
293
+ [ navComponents , 'navigation' ]
294
+ ] . map ( ( item , idx ) => makeMenuCategory ( item [ 0 ] , item [ 1 ] , idx ) )
306
295
: [
307
- [ HTMLElements , 'Text and Visual' ] ,
308
- [ InputElements , 'Forms and Inputs' ] ,
309
- [ HTMLlists , 'lists' ] ,
310
- ] . map ( ( item , idx ) => makeMenuCategory ( item [ 0 ] , item [ 1 ] , idx ) ) }
296
+ [ HTMLElements , 'Text and Visual' ] ,
297
+ [ InputElements , 'Forms and Inputs' ] ,
298
+ [ HTMLlists , 'lists' ]
299
+ ] . map ( ( item , idx ) => makeMenuCategory ( item [ 0 ] , item [ 1 ] , idx ) ) }
311
300
</ div >
312
301
) ;
313
302
} ;
0 commit comments