@@ -23,12 +23,7 @@ const getIconElement = props => {
23
23
} ) ;
24
24
} ;
25
25
26
- const getTextColor = ( tone , isHover = false , theme ) => {
27
- const overwrittenVars = {
28
- ...vars ,
29
- ...theme ,
30
- } ;
31
-
26
+ const getTextColor = ( tone , isHover = false , overwrittenVars ) => {
32
27
switch ( tone ) {
33
28
case 'primary' :
34
29
return isHover
@@ -54,42 +49,49 @@ export const FlatButton = props => {
54
49
label = { props . label }
55
50
onClick = { props . onClick }
56
51
isDisabled = { props . isDisabled }
57
- css = { theme => css `
58
- display : flex;
59
- align-items : center;
60
- font-size : 1rem ;
61
- border : none;
62
- background : none;
63
- padding : 0 ;
64
- min-height : initial;
65
-
66
- p {
67
- color : ${ props . isDisabled
68
- ? vars . colorNeutral
69
- : getTextColor ( props . tone , false , theme ) } ;
70
- }
52
+ css = { theme => {
53
+ const overwrittenVars = {
54
+ ...vars ,
55
+ ...theme ,
56
+ } ;
71
57
72
- svg * {
73
- fill : ${ props . isDisabled
74
- ? vars . colorNeutral
75
- : getTextColor ( props . tone , false , theme ) } ;
76
- }
58
+ return css `
59
+ display : flex;
60
+ align-items : center;
61
+ font-size : 1rem ;
62
+ border : none;
63
+ background : none;
64
+ padding : 0 ;
65
+ min-height : initial;
77
66
78
- & : hover ,
79
- & : focus {
80
67
p {
81
68
color : ${ props . isDisabled
82
- ? vars . colorNeutral
83
- : getTextColor ( props . tone , true , theme ) } ;
69
+ ? overwrittenVars . colorNeutral
70
+ : getTextColor ( props . tone , false , overwrittenVars ) } ;
84
71
}
85
72
86
73
svg * {
87
74
fill : ${ props . isDisabled
88
- ? vars . colorNeutral
89
- : getTextColor ( props . tone , true , theme ) } ;
75
+ ? overwrittenVars . colorNeutral
76
+ : getTextColor ( props . tone , false , overwrittenVars ) } ;
77
+ }
78
+
79
+ & : hover ,
80
+ & : focus {
81
+ p {
82
+ color : ${ props . isDisabled
83
+ ? overwrittenVars . colorNeutral
84
+ : getTextColor ( props . tone , true , overwrittenVars ) } ;
85
+ }
86
+
87
+ svg * {
88
+ fill : ${ props . isDisabled
89
+ ? overwrittenVars . colorNeutral
90
+ : getTextColor ( props . tone , true , overwrittenVars ) } ;
91
+ }
90
92
}
91
- }
92
- ` }
93
+ ` ;
94
+ } }
93
95
buttonAttributes = { dataProps }
94
96
>
95
97
< Spacings . Inline scale = "xs" alignItems = "center" >
0 commit comments