@@ -33,108 +33,35 @@ const colorStyles = ({ theme, $alertType }: ThemeProps<DefaultTheme> & IStyledGl
3333 let anchorActiveColor ;
3434 let focusVariable ;
3535
36- switch ( $alertType ) {
37- case 'success' : {
38- borderColor = getColor ( {
39- variable : 'border.successEmphasis' ,
40- light : { offset : 100 } ,
41- theme
42- } ) ;
43- backgroundColor = getColor ( {
44- variable : 'background.successEmphasis' ,
45- theme
46- } ) ;
47- foregroundColor = getColor ( {
48- variable : 'foreground.success' ,
49- light : { offset : - 600 } ,
50- theme
51- } ) ;
52- focusVariable = 'foreground.successEmphasis' ;
53- break ;
54- }
55- case 'error' : {
56- borderColor = getColor ( {
57- variable : 'border.dangerEmphasis' ,
58- light : { offset : 100 } ,
59- theme
60- } ) ;
61- backgroundColor = getColor ( {
62- variable : 'background.dangerEmphasis' ,
63- theme
64- } ) ;
65- foregroundColor = getColor ( {
66- variable : 'foreground.danger' ,
67- light : { offset : - 600 } ,
68- theme
69- } ) ;
70- focusVariable = 'foreground.dangerEmphasis' ;
71- break ;
72- }
73- case 'warning' : {
74- borderColor = getColor ( {
75- variable : 'border.warningEmphasis' ,
76- light : { offset : - 300 } ,
77- theme
78- } ) ;
79- backgroundColor = getColor ( {
80- variable : 'background.warningEmphasis' ,
81- light : { offset : - 400 } ,
82- theme
83- } ) ;
84- const fgVariable = 'foreground.warning' ;
85- foregroundColor = getColor ( {
86- variable : fgVariable ,
87- light : { offset : 100 } ,
88- theme
89- } ) ;
90- anchorHoverColor = getColor ( {
91- variable : fgVariable ,
92- light : { offset : 200 } ,
93- theme
94- } ) ;
95- anchorActiveColor = getColor ( {
96- variable : fgVariable ,
97- light : { offset : 300 } ,
98- theme
99- } ) ;
100- focusVariable = fgVariable ;
101- break ;
102- }
103- case 'info' : {
104- borderColor = getColor ( {
105- variable : 'border.primaryEmphasis' ,
106- light : { offset : - 300 } ,
107- theme
108- } ) ;
109- backgroundColor = getColor ( {
110- variable : 'background.primaryEmphasis' ,
111- light : { offset : - 400 } ,
112- theme
113- } ) ;
114- const fgVariable = 'foreground.primary' ;
115- foregroundColor = getColor ( {
116- variable : fgVariable ,
117- light : { offset : 100 } ,
118- theme
119- } ) ;
120- anchorHoverColor = getColor ( {
121- variable : fgVariable ,
122- light : { offset : 200 } ,
123- theme
124- } ) ;
125- anchorActiveColor = getColor ( {
126- variable : fgVariable ,
127- light : { offset : 300 } ,
128- theme
129- } ) ;
130- focusVariable = fgVariable ;
131- break ;
132- }
133- }
134-
135- if ( [ 'success' , 'error' ] . includes ( $alertType ) ) {
36+ if ( [ 'error' , 'success' ] . includes ( $alertType ) ) {
37+ const borderVariable =
38+ $alertType === 'success' ? 'border.successEmphasis' : 'border.dangerEmphasis' ;
39+ const backgroundVariable =
40+ $alertType === 'success' ? 'background.successEmphasis' : 'background.dangerEmphasis' ;
41+ const foregroundVariable =
42+ $alertType === 'success' ? 'foreground.success' : 'foreground.danger' ;
43+
44+ borderColor = getColor ( { variable : borderVariable , light : { offset : 100 } , theme } ) ;
45+ backgroundColor = getColor ( { variable : backgroundVariable , theme } ) ;
46+ foregroundColor = getColor ( { variable : foregroundVariable , light : { offset : - 600 } , theme } ) ;
47+ focusVariable =
48+ $alertType === 'success' ? 'foreground.successEmphasis' : 'foreground.dangerEmphasis' ;
13649 anchorHoverColor = theme . palette . white ;
13750 anchorActiveColor = theme . palette . white ;
51+ } else {
52+ const borderVariable =
53+ $alertType === 'warning' ? 'border.warningEmphasis' : 'border.primaryEmphasis' ;
54+ const backgroundVariable =
55+ $alertType === 'warning' ? 'background.warningEmphasis' : 'background.primaryEmphasis' ;
56+ const foregroundVariable =
57+ $alertType === 'warning' ? 'foreground.warning' : 'foreground.primary' ;
58+
59+ borderColor = getColor ( { variable : borderVariable , light : { offset : - 300 } , theme } ) ;
60+ backgroundColor = getColor ( { variable : backgroundVariable , light : { offset : - 400 } , theme } ) ;
61+ foregroundColor = getColor ( { variable : foregroundVariable , light : { offset : 100 } , theme } ) ;
62+ anchorHoverColor = getColor ( { variable : foregroundVariable , light : { offset : 200 } , theme } ) ;
63+ anchorActiveColor = getColor ( { variable : foregroundVariable , light : { offset : 300 } , theme } ) ;
64+ focusVariable = foregroundVariable ;
13865 }
13966
14067 // Apply a border without affecting the element's size
0 commit comments