@@ -14,73 +14,12 @@ import { HTMLelements } from '../../utils/htmlElements.util';
14
14
import { PropsInt , PropInt } from '../../interfaces/Interfaces' ;
15
15
16
16
interface HTMLAttrPropsInt extends PropsInt {
17
- classes : any ;
18
- updateHtmlAttr ( arg : { attr : string ; value : string } ) : void ;
19
- deleteProp ( id : number ) : void ;
20
- addProp ( prop : PropInt ) : void ;
17
+ classes ?: any ;
18
+ updateHtmlAttr ?: ( arg : { attr : string ; value : string } ) => void ;
21
19
}
22
20
23
21
interface StateInt { }
24
22
25
- const styles = ( theme : Theme ) : any => ( {
26
- root : {
27
- display : 'flex' ,
28
- justifyContent : 'center' ,
29
- flexWrap : 'wrap' ,
30
- height : '30px' ,
31
- width : '15rem' ,
32
- marginTop : '1rem' ,
33
- borderRadius : '5px'
34
- // border: '1px solid orange'
35
- } ,
36
- cssLabel : {
37
- color : 'white' ,
38
- marginTop : '10px'
39
- // border: '1px solid blue'
40
- } ,
41
- cssFocused : {
42
- color : 'green'
43
- } ,
44
- input : {
45
- color : '#fff' ,
46
- opacity : '0.7' ,
47
- height : '45px' ,
48
- width : '146px' ,
49
- marginTop : '20px' ,
50
- borderRadius : '5px' ,
51
- border : '1px solid #33eb91'
52
- } ,
53
- select : {
54
- background : '#424242' ,
55
- height : '45px' ,
56
- width : '146px' ,
57
- marginTop : '0px' ,
58
- color : '#fff' ,
59
- paddingLeft : '14px' ,
60
- borderRadius : '5px'
61
- } ,
62
- selectLabel : {
63
- color : 'white' ,
64
- zIndex : '10' ,
65
- dropShadow : '1px 1px 3px #fff' ,
66
- marginTop : '10px'
67
- // border: '1px solid blue'
68
- } ,
69
-
70
- save : {
71
- height : '45px' ,
72
- width : '146px' ,
73
- marginTop : '23px' ,
74
- marginLeft : '35px' ,
75
- borderRadius : '2px'
76
- }
77
- // input: { // commented out b/c Typescript/Material doesn't allow 'input' in its styles object
78
- // color: '#fff',
79
- // opacity: '0.7',
80
- // marginBottom: '15px'
81
- // }
82
- } ) ;
83
-
84
23
const mapDispatchToProps = ( dispatch : any ) => ( {
85
24
updateHtmlAttr : ( { attr, value } : { attr : string ; value : string } ) => {
86
25
dispatch ( updateHtmlAttr ( { attr, value } ) ) ;
@@ -126,14 +65,6 @@ class HtmlAttr extends Component<HTMLAttrPropsInt, StateInt> {
126
65
| React . ChangeEvent < HTMLInputElement >
127
66
| React . ChangeEvent < HTMLSelectElement >
128
67
) => {
129
- // if ( -- COMMENTED OUT UNNEEDED CODE. DROPDOWN ONLY HAS THOSE THREE OPTIONS. REMOVE THIS EVENTUALLY.
130
- // event.target.value == 'button' ||
131
- // event.target.value == 'submit' ||
132
- // event.target.value == 'reset'
133
- // ) {
134
- // buttonTypeTemp = event.target.value;
135
- // }
136
-
137
68
// reassigns global variable for use by other listener functions
138
69
buttonTypeTemp = event . target . value ;
139
70
@@ -180,15 +111,17 @@ class HtmlAttr extends Component<HTMLAttrPropsInt, StateInt> {
180
111
condition to render a "select" component rather than a text-input component */ }
181
112
{ attr == 'type' ? (
182
113
< FormControl required >
183
- < InputLabel className = { classes . selectLabel } htmlFor = ' htmlType' >
114
+ < InputLabel className = { classes . selectLabel } htmlFor = " htmlType" >
184
115
Type
185
116
</ InputLabel >
186
117
< Select
187
118
native
188
119
className = { classes . select }
189
- id = 'htmlType'
190
- placeholder = 'title'
191
- onChange = { event => this . handleChange ( event ) }
120
+ id = "htmlType"
121
+ placeholder = "title"
122
+ onChange = { ( event : React . ChangeEvent < HTMLSelectElement > ) =>
123
+ this . handleChange ( event )
124
+ }
192
125
value = { buttonTypeTemp }
193
126
defaultValue = { `${ `` } ` }
194
127
required
@@ -202,32 +135,27 @@ class HtmlAttr extends Component<HTMLAttrPropsInt, StateInt> {
202
135
classes : {
203
136
root : classes . cssLabel ,
204
137
focused : classes . cssFocused
205
- // input: classes.inputLabel -- commented out because 'input' not valid on Material typing
206
138
}
207
139
} }
208
140
InputProps = { {
209
141
className : classes . input
210
142
} }
211
143
label = { attr }
212
- variant = ' outlined'
144
+ variant = " outlined"
213
145
id = { attr }
214
- onChange = { this . handleChange }
146
+ onChange = { ( event : React . ChangeEvent < HTMLInputElement > ) =>
147
+ this . handleChange
148
+ }
215
149
value = { this . state [ attr ] }
216
150
/>
217
151
) }
218
152
</ Grid >
219
153
< Grid item xs = { 2 } >
220
154
< Fab
221
- variant = 'extended'
222
- size = 'small'
223
- color = 'default'
224
- aria-label = 'Save'
225
- // style={{
226
- // marginLeft: '10px',
227
- // marginTop: '5px',
228
- // marginBottom: '10px',
229
- // border: '2px solid pink'
230
- // }}
155
+ variant = "extended"
156
+ size = "small"
157
+ color = "default"
158
+ aria-label = "Save"
231
159
className = { classes . save }
232
160
onClick = { e => {
233
161
e . preventDefault ( ) ;
@@ -255,6 +183,57 @@ class HtmlAttr extends Component<HTMLAttrPropsInt, StateInt> {
255
183
}
256
184
}
257
185
186
+ const styles = ( theme : Theme ) : any => ( {
187
+ root : {
188
+ display : 'flex' ,
189
+ justifyContent : 'center' ,
190
+ flexWrap : 'wrap' ,
191
+ height : '30px' ,
192
+ width : '15rem' ,
193
+ marginTop : '1rem' ,
194
+ borderRadius : '5px'
195
+ } ,
196
+ cssLabel : {
197
+ color : 'white' ,
198
+ marginTop : '10px'
199
+ } ,
200
+ cssFocused : {
201
+ color : 'green'
202
+ } ,
203
+ input : {
204
+ color : '#fff' ,
205
+ opacity : '0.7' ,
206
+ height : '45px' ,
207
+ width : '146px' ,
208
+ marginTop : '20px' ,
209
+ borderRadius : '5px' ,
210
+ border : '1px solid #33eb91'
211
+ } ,
212
+ select : {
213
+ background : '#424242' ,
214
+ height : '45px' ,
215
+ width : '146px' ,
216
+ marginTop : '0px' ,
217
+ color : '#fff' ,
218
+ paddingLeft : '14px' ,
219
+ borderRadius : '5px'
220
+ } ,
221
+ selectLabel : {
222
+ color : 'white' ,
223
+ zIndex : '10' ,
224
+ dropShadow : '1px 1px 3px #fff' ,
225
+ marginTop : '10px'
226
+ } ,
227
+
228
+ save : {
229
+ height : '45px' ,
230
+ width : '146px' ,
231
+ marginTop : '23px' ,
232
+ marginLeft : '35px' ,
233
+ borderRadius : '2px'
234
+ }
235
+ } ) ;
236
+
258
237
export default connect (
259
238
mapStateToProps ,
260
239
mapDispatchToProps
0 commit comments