Skip to content

V7/ ThemeManager #2484

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 2 additions & 54 deletions src/style/themeManager.ts
Original file line number Diff line number Diff line change
@@ -1,34 +1,15 @@
import _ from 'lodash';
import type {Context} from 'react';
import Colors from './colors';

interface Theme {
primaryColor: string,
CTA: {
textColor: string,
disabledColor: string,
backgroundColor: string
},
titleColor: string,
subtitleColor: string,
dividerColor: string,
components: Extendable
components: Extendable;
}

export class ThemeManager {
private themeContext?: Context<any>;

theme: Theme = {
primaryColor: Colors.$backgroundPrimaryHeavy,
CTA: {
textColor: Colors.white,
disabledColor: Colors.grey60,
backgroundColor: Colors.$backgroundPrimaryHeavy
},
titleColor: Colors.grey10,
subtitleColor: Colors.grey40,
dividerColor: Colors.grey70,
components: {} as Extendable // leave this key and delete the rest on V6
components: {} as Extendable
};

forcedTheme = {
Expand All @@ -43,10 +24,6 @@ export class ThemeManager {
return this.themeContext;
}

getTheme() {
return this.theme;
}

setItem(key: string, value: any) {
if (key === 'components') {
throw new Error('Overriding the "components" key is not possible.');
Expand Down Expand Up @@ -83,35 +60,6 @@ export class ThemeManager {
get forcedThemeComponents() {
return this.forcedTheme.components;
}

// TODO: remove getters below
get primaryColor() {
return this.theme.primaryColor;
}

get CTATextColor() {
return this.theme.CTA.textColor;
}

get CTADisabledColor() {
return this.theme.CTA.disabledColor;
}

get CTABackgroundColor() {
return this.theme.CTA.backgroundColor;
}

get titleColor() {
return this.theme.titleColor;
}

get subtitleColor() {
return this.theme.subtitleColor;
}

get dividerColor() {
return this.theme.dividerColor;
}
}

export default new ThemeManager();