Skip to content

Commit

Permalink
code refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
furknyavuz committed Aug 31, 2021
1 parent a62fc96 commit b81957a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 36 deletions.
42 changes: 6 additions & 36 deletions src/app/page/settings-layout/edit-theme/edit-theme.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,45 +29,15 @@
<hr/>
</div>
<div class="section horizontal">
<app-button1 [text]="'Default theme'" (click)="setThemeColorSetting(ThemeColorSettings.default)"
<app-button1 *ngFor="let themeColor of themeColorSettingsList"
(click)="setThemeColorSetting(themeColor)"
[text]="themeColor + ' theme' | titlecase"
[selected]="themeColorSetting === themeColor"
[themeColor]="themeColor"
[icon]="'tint'"
[transparent]="true"
[lighterContrast]="true"
[isSleekButton]="true"
[selected]="themeColorSetting === ThemeColorSettings.default"
[themeColor]="ThemeColorSettings.default">
</app-button1>
<app-button1 [text]="'Red theme'" (click)="setThemeColorSetting(ThemeColorSettings.red)"
[icon]="'tint'"
[transparent]="true"
[lighterContrast]="true"
[isSleekButton]="true"
[selected]="themeColorSetting === ThemeColorSettings.red"
[themeColor]="ThemeColorSettings.red">
</app-button1>
<app-button1 [text]="'Yellow theme'" (click)="setThemeColorSetting(ThemeColorSettings.yellow)"
[icon]="'tint'"
[transparent]="true"
[lighterContrast]="true"
[isSleekButton]="true"
[selected]="themeColorSetting === ThemeColorSettings.yellow"
[themeColor]="ThemeColorSettings.yellow">
</app-button1>
<app-button1 [text]="'Blue theme'" (click)="setThemeColorSetting(ThemeColorSettings.blue)"
[icon]="'tint'"
[transparent]="true"
[lighterContrast]="true"
[isSleekButton]="true"
[selected]="themeColorSetting === ThemeColorSettings.blue"
[themeColor]="ThemeColorSettings.blue">
</app-button1>
<app-button1 [text]="'Green theme'" (click)="setThemeColorSetting(ThemeColorSettings.green)"
[icon]="'tint'"
[transparent]="true"
[lighterContrast]="true"
[isSleekButton]="true"
[selected]="themeColorSetting === ThemeColorSettings.green"
[themeColor]="ThemeColorSettings.green">
[isSleekButton]="true">
</app-button1>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export class EditThemeComponent {
DarkLightSettings = DarkLightSettings;
ThemeColorSettings = ThemeColorSettings;

themeColorSettingsList = [];

constructor( public themeService: ThemeService ) {

this.themeService.darkLightSetting.subscribe( darkLightSetting => {
Expand All @@ -26,6 +28,12 @@ export class EditThemeComponent {
this.themeService.themeColorSetting.subscribe( themeColorSetting => {
this.themeColorSetting = themeColorSetting;
} );

for ( const key in ThemeColorSettings ) {
if ( ThemeColorSettings.hasOwnProperty( key ) ) {
this.themeColorSettingsList.push(ThemeColorSettings[key]);
}
}
}

setDarkLightSetting( darkLightSetting: string ) {
Expand Down

0 comments on commit b81957a

Please sign in to comment.