Skip to content

Commit ecdd7a3

Browse files
committed
fix: increase specificity of app styles
1 parent 6a547c1 commit ecdd7a3

18 files changed

+276
-233
lines changed

src/ui/assets/jss/material-dashboard-react.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,15 @@ const cardLink = {
251251
},
252252
};
253253

254+
function increaseSpecificity(styles) {
255+
return {
256+
'&&': styles,
257+
};
258+
}
259+
254260
export {
255261
hexToRgb,
262+
increaseSpecificity,
256263
// variables
257264
drawerWidth,
258265
transition,
Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,52 @@
1-
import { primaryColor, blackColor, hexToRgb } from '../material-dashboard-react.js';
1+
import {
2+
primaryColor,
3+
blackColor,
4+
hexToRgb,
5+
increaseSpecificity,
6+
} from '../material-dashboard-react.js';
27

38
const checkboxAdnRadioStyle = {
4-
root: {
9+
root: increaseSpecificity({
510
padding: '13px',
611
'&:hover': {
712
backgroundColor: 'unset',
813
},
9-
},
10-
labelRoot: {
14+
}),
15+
labelRoot: increaseSpecificity({
1116
marginLeft: '-14px',
12-
},
13-
checked: {
17+
}),
18+
checked: increaseSpecificity({
1419
color: primaryColor[0] + '!important',
15-
},
16-
checkedIcon: {
20+
}),
21+
checkedIcon: increaseSpecificity({
1722
width: '20px',
1823
height: '20px',
1924
border: '1px solid rgba(' + hexToRgb(blackColor) + ', .54)',
2025
borderRadius: '3px',
21-
},
22-
uncheckedIcon: {
26+
}),
27+
uncheckedIcon: increaseSpecificity({
2328
width: '0px',
2429
height: '0px',
2530
padding: '10px',
2631
border: '1px solid rgba(' + hexToRgb(blackColor) + ', .54)',
2732
borderRadius: '3px',
28-
},
29-
radio: {
33+
}),
34+
radio: increaseSpecificity({
3035
color: primaryColor[0] + '!important',
31-
},
32-
radioChecked: {
36+
}),
37+
radioChecked: increaseSpecificity({
3338
width: '20px',
3439
height: '20px',
3540
border: '1px solid ' + primaryColor[0],
3641
borderRadius: '50%',
37-
},
38-
radioUnchecked: {
42+
}),
43+
radioUnchecked: increaseSpecificity({
3944
width: '0px',
4045
height: '0px',
4146
padding: '10px',
4247
border: '1px solid rgba(' + hexToRgb(blackColor) + ', .54)',
4348
borderRadius: '50%',
44-
},
49+
}),
4550
};
4651

4752
export default checkboxAdnRadioStyle;

src/ui/assets/jss/material-dashboard-react/components/buttonStyle.js

Lines changed: 36 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@ import {
99
whiteColor,
1010
blackColor,
1111
hexToRgb,
12+
increaseSpecificity,
1213
} from '../../material-dashboard-react.js';
1314

1415
const buttonStyle = {
15-
button: {
16+
button: increaseSpecificity({
1617
minHeight: 'auto',
1718
minWidth: 'auto',
1819
backgroundColor: grayColor[0],
@@ -88,14 +89,14 @@ const buttonStyle = {
8889
fontSize: '20px',
8990
},
9091
},
91-
},
92-
white: {
92+
}),
93+
white: increaseSpecificity({
9394
'&,&:focus,&:hover': {
9495
backgroundColor: whiteColor,
9596
color: grayColor[0],
9697
},
97-
},
98-
rose: {
98+
}),
99+
rose: increaseSpecificity({
99100
backgroundColor: roseColor[0],
100101
boxShadow:
101102
'0 2px 2px 0 rgba(' +
@@ -116,8 +117,8 @@ const buttonStyle = {
116117
hexToRgb(roseColor[0]) +
117118
', 0.2)',
118119
},
119-
},
120-
primary: {
120+
}),
121+
primary: increaseSpecificity({
121122
backgroundColor: primaryColor[0],
122123
boxShadow:
123124
'0 2px 2px 0 rgba(' +
@@ -138,8 +139,8 @@ const buttonStyle = {
138139
hexToRgb(primaryColor[0]) +
139140
', 0.2)',
140141
},
141-
},
142-
info: {
142+
}),
143+
info: increaseSpecificity({
143144
backgroundColor: infoColor[0],
144145
boxShadow:
145146
'0 2px 2px 0 rgba(' +
@@ -160,8 +161,8 @@ const buttonStyle = {
160161
hexToRgb(infoColor[0]) +
161162
', 0.2)',
162163
},
163-
},
164-
success: {
164+
}),
165+
success: increaseSpecificity({
165166
backgroundColor: successColor[0],
166167
boxShadow:
167168
'0 2px 2px 0 rgba(' +
@@ -182,8 +183,8 @@ const buttonStyle = {
182183
hexToRgb(successColor[0]) +
183184
', 0.2)',
184185
},
185-
},
186-
warning: {
186+
}),
187+
warning: increaseSpecificity({
187188
backgroundColor: warningColor[0],
188189
boxShadow:
189190
'0 2px 2px 0 rgba(' +
@@ -204,8 +205,8 @@ const buttonStyle = {
204205
hexToRgb(warningColor[0]) +
205206
', 0.2)',
206207
},
207-
},
208-
danger: {
208+
}),
209+
danger: increaseSpecificity({
209210
backgroundColor: dangerColor[0],
210211
boxShadow:
211212
'0 2px 2px 0 rgba(' +
@@ -226,8 +227,8 @@ const buttonStyle = {
226227
hexToRgb(dangerColor[0]) +
227228
', 0.2)',
228229
},
229-
},
230-
simple: {
230+
}),
231+
simple: increaseSpecificity({
231232
'&,&:focus,&:hover': {
232233
color: whiteColor,
233234
background: 'transparent',
@@ -263,44 +264,45 @@ const buttonStyle = {
263264
color: dangerColor[0],
264265
},
265266
},
266-
},
267-
transparent: {
267+
}),
268+
269+
transparent: increaseSpecificity({
268270
'&,&:focus,&:hover': {
269271
color: 'inherit',
270272
background: 'transparent',
271273
boxShadow: 'none',
272274
},
273-
},
274-
disabled: {
275+
}),
276+
disabled: increaseSpecificity({
275277
opacity: '0.65',
276278
pointerEvents: 'none',
277-
},
278-
lg: {
279+
}),
280+
lg: increaseSpecificity({
279281
padding: '1.125rem 2.25rem',
280282
fontSize: '0.875rem',
281283
lineHeight: '1.333333',
282284
borderRadius: '0.2rem',
283-
},
284-
sm: {
285+
}),
286+
sm: increaseSpecificity({
285287
padding: '0.40625rem 1.25rem',
286288
fontSize: '0.6875rem',
287289
lineHeight: '1.5',
288290
borderRadius: '0.2rem',
289-
},
290-
round: {
291+
}),
292+
round: increaseSpecificity({
291293
borderRadius: '30px',
292-
},
293-
block: {
294+
}),
295+
block: increaseSpecificity({
294296
width: '100% !important',
295-
},
296-
link: {
297+
}),
298+
link: increaseSpecificity({
297299
'&,&:hover,&:focus': {
298300
backgroundColor: 'transparent',
299301
color: grayColor[0],
300302
boxShadow: 'none',
301303
},
302-
},
303-
justIcon: {
304+
}),
305+
justIcon: increaseSpecificity({
304306
paddingLeft: '12px',
305307
paddingRight: '12px',
306308
fontSize: '20px',
@@ -337,7 +339,7 @@ const buttonStyle = {
337339
height: '17px',
338340
},
339341
},
340-
},
342+
}),
341343
};
342344

343345
export default buttonStyle;

src/ui/assets/jss/material-dashboard-react/components/customInputStyle.js

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,48 +4,49 @@ import {
44
successColor,
55
grayColor,
66
defaultFont,
7+
increaseSpecificity,
78
} from '../../material-dashboard-react.js';
89

910
const customInputStyle = {
10-
disabled: {
11+
disabled: increaseSpecificity({
1112
'&:before': {
1213
backgroundColor: 'transparent !important',
1314
},
14-
},
15-
underline: {
15+
}),
16+
underline: increaseSpecificity({
1617
'&:hover:not($disabled):before,&:before': {
1718
borderColor: grayColor[4] + ' !important',
1819
borderWidth: '1px !important',
1920
},
2021
'&:after': {
2122
borderColor: primaryColor[0],
2223
},
23-
},
24-
underlineError: {
24+
}),
25+
underlineError: increaseSpecificity({
2526
'&:after': {
2627
borderColor: dangerColor[0],
2728
},
28-
},
29-
underlineSuccess: {
29+
}),
30+
underlineSuccess: increaseSpecificity({
3031
'&:after': {
3132
borderColor: successColor[0],
3233
},
33-
},
34-
labelRoot: {
34+
}),
35+
labelRoot: increaseSpecificity({
3536
...defaultFont,
3637
color: grayColor[3] + ' !important',
3738
fontWeight: '400',
3839
fontSize: '14px',
3940
lineHeight: '1.42857',
4041
letterSpacing: 'unset',
41-
},
42-
labelRootError: {
42+
}),
43+
labelRootError: increaseSpecificity({
4344
color: dangerColor[0],
44-
},
45-
labelRootSuccess: {
45+
}),
46+
labelRootSuccess: increaseSpecificity({
4647
color: successColor[0],
47-
},
48-
feedback: {
48+
}),
49+
feedback: increaseSpecificity({
4950
position: 'absolute',
5051
top: '18px',
5152
right: '0',
@@ -55,16 +56,16 @@ const customInputStyle = {
5556
height: '24px',
5657
textAlign: 'center',
5758
pointerEvents: 'none',
58-
},
59-
marginTop: {
59+
}),
60+
marginTop: increaseSpecificity({
6061
marginTop: '16px',
61-
},
62-
formControl: {
62+
}),
63+
formControl: increaseSpecificity({
6364
paddingBottom: '10px',
6465
margin: '27px 0 0 0',
6566
position: 'relative',
6667
verticalAlign: 'unset',
67-
},
68+
}),
6869
};
6970

7071
export default customInputStyle;

0 commit comments

Comments
 (0)