1
+ import { createStyles , Theme } from '@material-ui/core/styles' ;
1
2
import {
2
3
grayColor ,
3
4
primaryColor ,
@@ -9,76 +10,67 @@ import {
9
10
whiteColor ,
10
11
blackColor ,
11
12
hexToRgb ,
12
- } from '../../material-dashboard-react.js ' ;
13
+ } from '../../material-dashboard-react' ;
13
14
14
- const buttonStyle = {
15
+ const buttonStyle = ( theme : Theme ) => createStyles ( {
15
16
button : {
16
17
minHeight : 'auto' ,
17
18
minWidth : 'auto' ,
18
19
backgroundColor : grayColor [ 0 ] ,
19
20
color : whiteColor ,
20
21
boxShadow :
21
- '0 2px 2px 0 rgba(' +
22
- hexToRgb ( grayColor [ 0 ] ) +
23
- ', 0.14), 0 3px 1px -2px rgba(' +
24
- hexToRgb ( grayColor [ 0 ] ) +
25
- ', 0.2), 0 1px 5px 0 rgba(' +
26
- hexToRgb ( grayColor [ 0 ] ) +
27
- ', 0.12)' ,
22
+ `0 2px 2px 0 rgba(${ hexToRgb ( grayColor [ 0 ] ) } , 0.14),
23
+ 0 3px 1px -2px rgba(${ hexToRgb ( grayColor [ 0 ] ) } , 0.2),
24
+ 0 1px 5px 0 rgba(${ hexToRgb ( grayColor [ 0 ] ) } , 0.12)` ,
28
25
border : 'none' ,
29
26
borderRadius : '3px' ,
30
- position : 'relative' ,
27
+ position : 'relative' as const ,
31
28
padding : '12px 30px' ,
32
29
margin : '.3125rem 1px' ,
33
30
fontSize : '12px' ,
34
- fontWeight : ' 400' ,
35
- textTransform : 'uppercase' ,
31
+ fontWeight : 400 as const ,
32
+ textTransform : 'uppercase' as const ,
36
33
letterSpacing : '0' ,
37
34
willChange : 'box-shadow, transform' ,
38
35
transition :
39
- // eslint-disable-next-line max-len
40
36
'box-shadow 0.2s cubic-bezier(0.4, 0, 1, 1), background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1)' ,
41
37
lineHeight : '1.42857143' ,
42
- textAlign : 'center' ,
43
- whiteSpace : 'nowrap' ,
44
- verticalAlign : 'middle' ,
45
- touchAction : 'manipulation' ,
46
- cursor : 'pointer' ,
38
+ textAlign : 'center' as const ,
39
+ whiteSpace : 'nowrap' as const ,
40
+ verticalAlign : 'middle' as const ,
41
+ touchAction : 'manipulation' as const ,
42
+ cursor : 'pointer' as const ,
47
43
'&:hover,&:focus' : {
48
44
color : whiteColor ,
49
45
backgroundColor : grayColor [ 0 ] ,
50
46
boxShadow :
51
- '0 14px 26px -12px rgba(' +
52
- hexToRgb ( grayColor [ 0 ] ) +
53
- ', 0.42), 0 4px 23px 0px rgba(' +
54
- hexToRgb ( blackColor ) +
55
- ', 0.12), 0 8px 10px -5px rgba(' +
56
- hexToRgb ( grayColor [ 0 ] ) +
57
- ', 0.2)' ,
47
+ `0 14px 26px -12px rgba(${ hexToRgb ( grayColor [ 0 ] ) } , 0.42),
48
+ 0 4px 23px 0px rgba(${ hexToRgb ( blackColor ) } , 0.12),
49
+ 0 8px 10px -5px rgba(${ hexToRgb ( grayColor [ 0 ] ) } , 0.2)` ,
58
50
} ,
59
51
'& .fab,& .fas,& .far,& .fal, &.material-icons' : {
60
- position : 'relative' ,
61
- display : 'inline-block' ,
52
+ position : 'relative' as const ,
53
+ display : 'inline-block' as const ,
62
54
top : '0' ,
63
55
marginTop : '-1em' ,
64
56
marginBottom : '-1em' ,
65
57
fontSize : '1.1rem' ,
66
58
marginRight : '4px' ,
67
- verticalAlign : 'middle' ,
59
+ verticalAlign : 'middle' as const ,
68
60
} ,
69
61
'& svg' : {
70
- position : 'relative' ,
71
- display : 'inline-block' ,
62
+ position : 'relative' as const ,
63
+ display : 'inline-block' as const ,
72
64
top : '0' ,
73
65
width : '18px' ,
74
66
height : '18px' ,
75
67
marginRight : '4px' ,
76
- verticalAlign : 'middle' ,
68
+ verticalAlign : 'middle' as const ,
77
69
} ,
78
70
'&$justIcon' : {
79
71
'& .fab,& .fas,& .far,& .fal,& .material-icons' : {
80
72
marginTop : '0px' ,
81
- position : 'absolute' ,
73
+ position : 'absolute' as const ,
82
74
width : '100%' ,
83
75
transform : 'none' ,
84
76
left : '0px' ,
@@ -98,133 +90,85 @@ const buttonStyle = {
98
90
rose : {
99
91
backgroundColor : roseColor [ 0 ] ,
100
92
boxShadow :
101
- '0 2px 2px 0 rgba(' +
102
- hexToRgb ( roseColor [ 0 ] ) +
103
- ', 0.14), 0 3px 1px -2px rgba(' +
104
- hexToRgb ( roseColor [ 0 ] ) +
105
- ', 0.2), 0 1px 5px 0 rgba(' +
106
- hexToRgb ( roseColor [ 0 ] ) +
107
- ', 0.12)' ,
93
+ `0 2px 2px 0 rgba(${ hexToRgb ( roseColor [ 0 ] ) } , 0.14),
94
+ 0 3px 1px -2px rgba(${ hexToRgb ( roseColor [ 0 ] ) } , 0.2),
95
+ 0 1px 5px 0 rgba(${ hexToRgb ( roseColor [ 0 ] ) } , 0.12)` ,
108
96
'&:hover,&:focus' : {
109
97
backgroundColor : roseColor [ 0 ] ,
110
98
boxShadow :
111
- '0 14px 26px -12px rgba(' +
112
- hexToRgb ( roseColor [ 0 ] ) +
113
- ', 0.42), 0 4px 23px 0px rgba(' +
114
- hexToRgb ( blackColor ) +
115
- ', 0.12), 0 8px 10px -5px rgba(' +
116
- hexToRgb ( roseColor [ 0 ] ) +
117
- ', 0.2)' ,
99
+ `0 14px 26px -12px rgba(${ hexToRgb ( roseColor [ 0 ] ) } , 0.42),
100
+ 0 4px 23px 0px rgba(${ hexToRgb ( blackColor ) } , 0.12),
101
+ 0 8px 10px -5px rgba(${ hexToRgb ( roseColor [ 0 ] ) } , 0.2)` ,
118
102
} ,
119
103
} ,
120
104
primary : {
121
105
backgroundColor : primaryColor [ 0 ] ,
122
106
boxShadow :
123
- '0 2px 2px 0 rgba(' +
124
- hexToRgb ( primaryColor [ 0 ] ) +
125
- ', 0.14), 0 3px 1px -2px rgba(' +
126
- hexToRgb ( primaryColor [ 0 ] ) +
127
- ', 0.2), 0 1px 5px 0 rgba(' +
128
- hexToRgb ( primaryColor [ 0 ] ) +
129
- ', 0.12)' ,
107
+ `0 2px 2px 0 rgba(${ hexToRgb ( primaryColor [ 0 ] ) } , 0.14),
108
+ 0 3px 1px -2px rgba(${ hexToRgb ( primaryColor [ 0 ] ) } , 0.2),
109
+ 0 1px 5px 0 rgba(${ hexToRgb ( primaryColor [ 0 ] ) } , 0.12)` ,
130
110
'&:hover,&:focus' : {
131
111
backgroundColor : primaryColor [ 0 ] ,
132
112
boxShadow :
133
- '0 14px 26px -12px rgba(' +
134
- hexToRgb ( primaryColor [ 0 ] ) +
135
- ', 0.42), 0 4px 23px 0px rgba(' +
136
- hexToRgb ( blackColor ) +
137
- ', 0.12), 0 8px 10px -5px rgba(' +
138
- hexToRgb ( primaryColor [ 0 ] ) +
139
- ', 0.2)' ,
113
+ `0 14px 26px -12px rgba(${ hexToRgb ( primaryColor [ 0 ] ) } , 0.42),
114
+ 0 4px 23px 0px rgba(${ hexToRgb ( blackColor ) } , 0.12),
115
+ 0 8px 10px -5px rgba(${ hexToRgb ( primaryColor [ 0 ] ) } , 0.2)` ,
140
116
} ,
141
117
} ,
142
118
info : {
143
119
backgroundColor : infoColor [ 0 ] ,
144
120
boxShadow :
145
- '0 2px 2px 0 rgba(' +
146
- hexToRgb ( infoColor [ 0 ] ) +
147
- ', 0.14), 0 3px 1px -2px rgba(' +
148
- hexToRgb ( infoColor [ 0 ] ) +
149
- ', 0.2), 0 1px 5px 0 rgba(' +
150
- hexToRgb ( infoColor [ 0 ] ) +
151
- ', 0.12)' ,
121
+ `0 2px 2px 0 rgba(${ hexToRgb ( infoColor [ 0 ] ) } , 0.14),
122
+ 0 3px 1px -2px rgba(${ hexToRgb ( infoColor [ 0 ] ) } , 0.2),
123
+ 0 1px 5px 0 rgba(${ hexToRgb ( infoColor [ 0 ] ) } , 0.12)` ,
152
124
'&:hover,&:focus' : {
153
125
backgroundColor : infoColor [ 0 ] ,
154
126
boxShadow :
155
- '0 14px 26px -12px rgba(' +
156
- hexToRgb ( infoColor [ 0 ] ) +
157
- ', 0.42), 0 4px 23px 0px rgba(' +
158
- hexToRgb ( blackColor ) +
159
- ', 0.12), 0 8px 10px -5px rgba(' +
160
- hexToRgb ( infoColor [ 0 ] ) +
161
- ', 0.2)' ,
127
+ `0 14px 26px -12px rgba(${ hexToRgb ( infoColor [ 0 ] ) } , 0.42),
128
+ 0 4px 23px 0px rgba(${ hexToRgb ( blackColor ) } , 0.12),
129
+ 0 8px 10px -5px rgba(${ hexToRgb ( infoColor [ 0 ] ) } , 0.2)` ,
162
130
} ,
163
131
} ,
164
132
success : {
165
133
backgroundColor : successColor [ 0 ] ,
166
134
boxShadow :
167
- '0 2px 2px 0 rgba(' +
168
- hexToRgb ( successColor [ 0 ] ) +
169
- ', 0.14), 0 3px 1px -2px rgba(' +
170
- hexToRgb ( successColor [ 0 ] ) +
171
- ', 0.2), 0 1px 5px 0 rgba(' +
172
- hexToRgb ( successColor [ 0 ] ) +
173
- ', 0.12)' ,
135
+ `0 2px 2px 0 rgba(${ hexToRgb ( successColor [ 0 ] ) } , 0.14),
136
+ 0 3px 1px -2px rgba(${ hexToRgb ( successColor [ 0 ] ) } , 0.2),
137
+ 0 1px 5px 0 rgba(${ hexToRgb ( successColor [ 0 ] ) } , 0.12)` ,
174
138
'&:hover,&:focus' : {
175
139
backgroundColor : successColor [ 0 ] ,
176
140
boxShadow :
177
- '0 14px 26px -12px rgba(' +
178
- hexToRgb ( successColor [ 0 ] ) +
179
- ', 0.42), 0 4px 23px 0px rgba(' +
180
- hexToRgb ( blackColor ) +
181
- ', 0.12), 0 8px 10px -5px rgba(' +
182
- hexToRgb ( successColor [ 0 ] ) +
183
- ', 0.2)' ,
141
+ `0 14px 26px -12px rgba(${ hexToRgb ( successColor [ 0 ] ) } , 0.42),
142
+ 0 4px 23px 0px rgba(${ hexToRgb ( blackColor ) } , 0.12),
143
+ 0 8px 10px -5px rgba(${ hexToRgb ( successColor [ 0 ] ) } , 0.2)` ,
184
144
} ,
185
145
} ,
186
146
warning : {
187
147
backgroundColor : warningColor [ 0 ] ,
188
148
boxShadow :
189
- '0 2px 2px 0 rgba(' +
190
- hexToRgb ( warningColor [ 0 ] ) +
191
- ', 0.14), 0 3px 1px -2px rgba(' +
192
- hexToRgb ( warningColor [ 0 ] ) +
193
- ', 0.2), 0 1px 5px 0 rgba(' +
194
- hexToRgb ( warningColor [ 0 ] ) +
195
- ', 0.12)' ,
149
+ `0 2px 2px 0 rgba(${ hexToRgb ( warningColor [ 0 ] ) } , 0.14),
150
+ 0 3px 1px -2px rgba(${ hexToRgb ( warningColor [ 0 ] ) } , 0.2),
151
+ 0 1px 5px 0 rgba(${ hexToRgb ( warningColor [ 0 ] ) } , 0.12)` ,
196
152
'&:hover,&:focus' : {
197
153
backgroundColor : warningColor [ 0 ] ,
198
154
boxShadow :
199
- '0 14px 26px -12px rgba(' +
200
- hexToRgb ( warningColor [ 0 ] ) +
201
- ', 0.42), 0 4px 23px 0px rgba(' +
202
- hexToRgb ( blackColor ) +
203
- ', 0.12), 0 8px 10px -5px rgba(' +
204
- hexToRgb ( warningColor [ 0 ] ) +
205
- ', 0.2)' ,
155
+ `0 14px 26px -12px rgba(${ hexToRgb ( warningColor [ 0 ] ) } , 0.42),
156
+ 0 4px 23px 0px rgba(${ hexToRgb ( blackColor ) } , 0.12),
157
+ 0 8px 10px -5px rgba(${ hexToRgb ( warningColor [ 0 ] ) } , 0.2)` ,
206
158
} ,
207
159
} ,
208
160
danger : {
209
161
backgroundColor : dangerColor [ 0 ] ,
210
162
boxShadow :
211
- '0 2px 2px 0 rgba(' +
212
- hexToRgb ( dangerColor [ 0 ] ) +
213
- ', 0.14), 0 3px 1px -2px rgba(' +
214
- hexToRgb ( dangerColor [ 0 ] ) +
215
- ', 0.2), 0 1px 5px 0 rgba(' +
216
- hexToRgb ( dangerColor [ 0 ] ) +
217
- ', 0.12)' ,
163
+ `0 2px 2px 0 rgba(${ hexToRgb ( dangerColor [ 0 ] ) } , 0.14),
164
+ 0 3px 1px -2px rgba(${ hexToRgb ( dangerColor [ 0 ] ) } , 0.2),
165
+ 0 1px 5px 0 rgba(${ hexToRgb ( dangerColor [ 0 ] ) } , 0.12)` ,
218
166
'&:hover,&:focus' : {
219
167
backgroundColor : dangerColor [ 0 ] ,
220
168
boxShadow :
221
- '0 14px 26px -12px rgba(' +
222
- hexToRgb ( dangerColor [ 0 ] ) +
223
- ', 0.42), 0 4px 23px 0px rgba(' +
224
- hexToRgb ( blackColor ) +
225
- ', 0.12), 0 8px 10px -5px rgba(' +
226
- hexToRgb ( dangerColor [ 0 ] ) +
227
- ', 0.2)' ,
169
+ `0 14px 26px -12px rgba(${ hexToRgb ( dangerColor [ 0 ] ) } , 0.42),
170
+ 0 4px 23px 0px rgba(${ hexToRgb ( blackColor ) } , 0.12),
171
+ 0 8px 10px -5px rgba(${ hexToRgb ( dangerColor [ 0 ] ) } , 0.2)` ,
228
172
} ,
229
173
} ,
230
174
simple : {
@@ -273,7 +217,7 @@ const buttonStyle = {
273
217
} ,
274
218
disabled : {
275
219
opacity : '0.65' ,
276
- pointerEvents : 'none' ,
220
+ pointerEvents : 'none' as const ,
277
221
} ,
278
222
lg : {
279
223
padding : '1.125rem 2.25rem' ,
@@ -338,6 +282,6 @@ const buttonStyle = {
338
282
} ,
339
283
} ,
340
284
} ,
341
- } ;
285
+ } ) ;
342
286
343
- export default buttonStyle ;
287
+ export default buttonStyle ;
0 commit comments