Skip to content

Commit

Permalink
fixes fossasia#1492: create enum for all theme types'
Browse files Browse the repository at this point in the history
  • Loading branch information
sakshee-19 committed Apr 5, 2019
1 parent 93a5eff commit d01347e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/app/theme/theme.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Component, OnInit } from '@angular/core';
import { ThemeService } from '../services/theme.service';
import { Theme } from '../types/theme';

@Component({
selector: 'app-theme',
Expand All @@ -20,22 +21,22 @@ export class ThemeComponent implements OnInit {

applyTheme(theme: string) {
switch (theme) {
case "darkTheme": {
case Theme.DarkTheme: {
return this.darkTheme();
}
case "basicTheme": {
case Theme.BasicTheme: {
return this.basicTheme();
}
case "contrastTheme": {
case Theme.ContrastTheme: {
return this.contrastTheme();
}
case "terminalTheme": {
case Theme.TerminalTheme: {
return this.terminalTheme();
}
case "nightTheme": {
case Theme.NightTheme: {
return this.nightTheme();
}
case "defaultTheme": {
case Theme.DefaultTheme: {
return this.defaultTheme();
}
default: {
Expand Down
8 changes: 8 additions & 0 deletions src/app/types/theme.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export const Theme = {
DarkTheme: "darkTheme",
BasicTheme: "basicTheme",
ContrastTheme: "contrastTheme",
TerminalTheme: "terminalTheme",
NightTheme: "nightTheme",
DefaultTheme: "defaultTheme"
}

0 comments on commit d01347e

Please sign in to comment.