@@ -14,73 +14,12 @@ import { HTMLelements } from '../../utils/htmlElements.util';
1414import { PropsInt , PropInt } from '../../interfaces/Interfaces' ;
1515
1616interface 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 ;
2119}
2220
2321interface StateInt { }
2422
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-
8423const mapDispatchToProps = ( dispatch : any ) => ( {
8524 updateHtmlAttr : ( { attr, value } : { attr : string ; value : string } ) => {
8625 dispatch ( updateHtmlAttr ( { attr, value } ) ) ;
@@ -126,14 +65,6 @@ class HtmlAttr extends Component<HTMLAttrPropsInt, StateInt> {
12665 | React . ChangeEvent < HTMLInputElement >
12766 | React . ChangeEvent < HTMLSelectElement >
12867 ) => {
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-
13768 // reassigns global variable for use by other listener functions
13869 buttonTypeTemp = event . target . value ;
13970
@@ -180,15 +111,17 @@ class HtmlAttr extends Component<HTMLAttrPropsInt, StateInt> {
180111 condition to render a "select" component rather than a text-input component */ }
181112 { attr == 'type' ? (
182113 < FormControl required >
183- < InputLabel className = { classes . selectLabel } htmlFor = ' htmlType' >
114+ < InputLabel className = { classes . selectLabel } htmlFor = " htmlType" >
184115 Type
185116 </ InputLabel >
186117 < Select
187118 native
188119 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+ }
192125 value = { buttonTypeTemp }
193126 defaultValue = { `${ `` } ` }
194127 required
@@ -202,32 +135,27 @@ class HtmlAttr extends Component<HTMLAttrPropsInt, StateInt> {
202135 classes : {
203136 root : classes . cssLabel ,
204137 focused : classes . cssFocused
205- // input: classes.inputLabel -- commented out because 'input' not valid on Material typing
206138 }
207139 } }
208140 InputProps = { {
209141 className : classes . input
210142 } }
211143 label = { attr }
212- variant = ' outlined'
144+ variant = " outlined"
213145 id = { attr }
214- onChange = { this . handleChange }
146+ onChange = { ( event : React . ChangeEvent < HTMLInputElement > ) =>
147+ this . handleChange
148+ }
215149 value = { this . state [ attr ] }
216150 />
217151 ) }
218152 </ Grid >
219153 < Grid item xs = { 2 } >
220154 < 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"
231159 className = { classes . save }
232160 onClick = { e => {
233161 e . preventDefault ( ) ;
@@ -255,6 +183,57 @@ class HtmlAttr extends Component<HTMLAttrPropsInt, StateInt> {
255183 }
256184}
257185
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+
258237export default connect (
259238 mapStateToProps ,
260239 mapDispatchToProps
0 commit comments