@@ -27,47 +27,82 @@ const styles = (theme: Theme): any => ({
27
27
display : 'flex' ,
28
28
justifyContent : 'center' ,
29
29
flexWrap : 'wrap' ,
30
+ height : '30px' ,
31
+ width : '15rem' ,
32
+ marginTop : '1rem' ,
33
+ borderRadius : '5px'
34
+ // border: '1px solid orange'
30
35
} ,
31
36
cssLabel : {
32
37
color : 'white' ,
38
+ marginTop : '10px'
39
+ // border: '1px solid blue'
33
40
} ,
34
41
cssFocused : {
35
- color : 'green' ,
42
+ color : 'green'
36
43
} ,
37
44
input : {
38
45
color : '#fff' ,
39
46
opacity : '0.7' ,
40
- marginBottom : '15px' ,
47
+ height : '45px' ,
48
+ width : '146px' ,
49
+ marginTop : '20px' ,
50
+ borderRadius : '5px' ,
51
+ border : '1px solid #33eb91'
41
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
+
68
+ // border: '1px solid blue'
69
+ } ,
70
+
71
+ save : {
72
+ height : '45px' ,
73
+ width : '146px' ,
74
+ marginTop : '23px' ,
75
+ marginLeft : '35px' ,
76
+ borderRadius : '2px'
77
+ }
42
78
} ) ;
43
79
44
80
const mapDispatchToProps = ( dispatch : any ) => ( {
45
81
updateHtmlAttr : ( { attr, value } : { attr : string ; value : string } ) => {
46
82
dispatch ( updateHtmlAttr ( { attr, value } ) ) ;
47
- } ,
83
+ }
48
84
} ) ;
49
85
50
86
const mapStateToProps = ( store : any ) => ( {
51
87
focusComponent : store . workspace . focusComponent ,
52
- focusChild : store . workspace . focusChild ,
88
+ focusChild : store . workspace . focusChild
53
89
} ) ;
54
90
55
91
// available types for select drop-down for button types
56
92
const availableButtonTypes = {
57
93
button : 'BUTTON' ,
58
94
submit : 'SUBMIT' ,
59
- reset : 'RESET' ,
95
+ reset : 'RESET'
60
96
} ;
61
97
62
98
// function for generating the button types for select dropdown
63
99
// uses Object.keys method on object of drop down types
64
100
const buttonTypeOptions = [
65
- < option value = '' key = '' /> ,
66
- ...Object . keys ( availableButtonTypes ) . map ( type => (
101
+ Object . keys ( availableButtonTypes ) . map ( type => (
67
102
< option value = { type } key = { type } style = { { color : '#000' } } >
68
103
{ type == null ? '' : type }
69
104
</ option >
70
- ) ) ,
105
+ ) )
71
106
] ;
72
107
73
108
// this is a variable to save temp state for button types
@@ -82,7 +117,7 @@ class HtmlAttr extends Component<HTMLAttrPropsInt, StateInt> {
82
117
83
118
return acc ;
84
119
} ,
85
- { } ,
120
+ { }
86
121
) ;
87
122
88
123
// State looks like:
@@ -92,16 +127,9 @@ class HtmlAttr extends Component<HTMLAttrPropsInt, StateInt> {
92
127
// propType: ''
93
128
94
129
handleChange = ( event : MouseEvent ) => {
95
- if (
96
- event . target . value == 'button' ||
97
- event . target . value == 'submit' ||
98
- event . target . value == 'reset'
99
- ) {
100
- buttonTypeTemp = event . target . value ;
101
- }
102
-
130
+ buttonTypeTemp = event . target . value ;
103
131
this . setState ( {
104
- [ event . target . id ] : event . target . value ,
132
+ [ event . target . id ] : buttonTypeTemp
105
133
} ) ;
106
134
} ;
107
135
@@ -111,12 +139,12 @@ class HtmlAttr extends Component<HTMLAttrPropsInt, StateInt> {
111
139
if ( attr == 'type' ) {
112
140
this . props . updateHtmlAttr ( { attr, value : buttonTypeTemp } ) ;
113
141
this . setState ( {
114
- [ attr ] : '' ,
142
+ [ attr ] : ''
115
143
} ) ;
116
144
} else {
117
145
this . props . updateHtmlAttr ( { attr, value : this . state [ attr ] } ) ;
118
146
this . setState ( {
119
- [ attr ] : '' ,
147
+ [ attr ] : ''
120
148
} ) ;
121
149
}
122
150
} ;
@@ -132,33 +160,28 @@ class HtmlAttr extends Component<HTMLAttrPropsInt, StateInt> {
132
160
container
133
161
spacing = { 0 }
134
162
key = { i }
135
- style = { { marginTop : '10px' , marginRight : '20px' } }
163
+ style = { {
164
+ marginTop : '10px' ,
165
+ marginRight : '20px' ,
166
+ background : '5px solid yellow'
167
+ } }
136
168
>
137
169
< Grid item xs = { 1 } >
138
170
{ /* if the attr being rendered for the HTMLForm is a button, then give it a special
139
171
condition to render a "select" component rather than a text-input component */ }
140
172
{ attr == 'type' ? (
141
173
< FormControl required >
142
- < InputLabel className = { classes . light } htmlFor = 'htmlType' >
174
+ < InputLabel className = { classes . selectLabel } htmlFor = 'htmlType' >
143
175
Type
144
176
</ InputLabel >
145
177
< Select
146
178
native
147
- className = { classes . light }
179
+ className = { classes . select }
148
180
id = 'htmlType'
149
181
placeholder = 'title'
150
182
onChange = { this . handleChange }
151
183
value = { buttonTypeTemp }
152
- defaultValue = { 'button' }
153
- style = { {
154
- background : '#424242' ,
155
- height : '45px' ,
156
- width : '146px' ,
157
- marginBottom : '23px' ,
158
- marginTop : '0px' ,
159
- color : '#fff' ,
160
- paddingLeft : '14px'
161
- } }
184
+ defaultValue = { `${ `` } ` }
162
185
required
163
186
>
164
187
{ buttonTypeOptions }
@@ -170,18 +193,12 @@ class HtmlAttr extends Component<HTMLAttrPropsInt, StateInt> {
170
193
classes : {
171
194
root : classes . cssLabel ,
172
195
focused : classes . cssFocused ,
173
- input : classes . input
196
+ input : classes . inputLabel
174
197
}
175
198
} }
176
199
InputProps = { {
177
- classes : {
178
- root : classes . cssOutlinedInput ,
179
- focused : classes . cssFocused ,
180
- notchedOutline : classes . notchedOutline ,
181
- input : classes . input
182
- }
200
+ className : classes . input
183
201
} }
184
- style = { { background : '#424242' , height : '70%' } }
185
202
label = { attr }
186
203
variant = 'outlined'
187
204
id = { attr }
@@ -196,11 +213,13 @@ class HtmlAttr extends Component<HTMLAttrPropsInt, StateInt> {
196
213
size = 'small'
197
214
color = 'default'
198
215
aria-label = 'Save'
199
- style = { {
200
- marginLeft : '10px' ,
201
- marginTop : '5px' ,
202
- marginBottom : '10px'
203
- } }
216
+ // style={{
217
+ // marginLeft: '10px',
218
+ // marginTop: '5px',
219
+ // marginBottom: '10px',
220
+ // border: '2px solid pink'
221
+ // }}
222
+ className = { classes . save }
204
223
onClick = { e => {
205
224
e . preventDefault ( ) ;
206
225
this . handleSave ( attr ) ;
0 commit comments