1
1
import _ from 'lodash' ;
2
2
import type { Context } from 'react' ;
3
- import Colors from './colors' ;
4
3
5
4
interface Theme {
6
- primaryColor : string ,
7
- CTA : {
8
- textColor : string ,
9
- disabledColor : string ,
10
- backgroundColor : string
11
- } ,
12
- titleColor : string ,
13
- subtitleColor : string ,
14
- dividerColor : string ,
15
- components : Extendable
5
+ components : Extendable ;
16
6
}
17
7
18
8
export class ThemeManager {
19
9
private themeContext ?: Context < any > ;
20
10
21
11
theme : Theme = {
22
- primaryColor : Colors . $backgroundPrimaryHeavy ,
23
- CTA : {
24
- textColor : Colors . white ,
25
- disabledColor : Colors . grey60 ,
26
- backgroundColor : Colors . $backgroundPrimaryHeavy
27
- } ,
28
- titleColor : Colors . grey10 ,
29
- subtitleColor : Colors . grey40 ,
30
- dividerColor : Colors . grey70 ,
31
- components : { } as Extendable // leave this key and delete the rest on V6
12
+ components : { } as Extendable
32
13
} ;
33
14
34
15
forcedTheme = {
@@ -43,10 +24,6 @@ export class ThemeManager {
43
24
return this . themeContext ;
44
25
}
45
26
46
- getTheme ( ) {
47
- return this . theme ;
48
- }
49
-
50
27
setItem ( key : string , value : any ) {
51
28
if ( key === 'components' ) {
52
29
throw new Error ( 'Overriding the "components" key is not possible.' ) ;
@@ -83,35 +60,6 @@ export class ThemeManager {
83
60
get forcedThemeComponents ( ) {
84
61
return this . forcedTheme . components ;
85
62
}
86
-
87
- // TODO: remove getters below
88
- get primaryColor ( ) {
89
- return this . theme . primaryColor ;
90
- }
91
-
92
- get CTATextColor ( ) {
93
- return this . theme . CTA . textColor ;
94
- }
95
-
96
- get CTADisabledColor ( ) {
97
- return this . theme . CTA . disabledColor ;
98
- }
99
-
100
- get CTABackgroundColor ( ) {
101
- return this . theme . CTA . backgroundColor ;
102
- }
103
-
104
- get titleColor ( ) {
105
- return this . theme . titleColor ;
106
- }
107
-
108
- get subtitleColor ( ) {
109
- return this . theme . subtitleColor ;
110
- }
111
-
112
- get dividerColor ( ) {
113
- return this . theme . dividerColor ;
114
- }
115
63
}
116
64
117
65
export default new ThemeManager ( ) ;
0 commit comments