mempool/frontend/src/app/components/theme-selector/theme-selector.component.ts

32 lines
936 B
TypeScript
Raw Normal View History

2023-01-02 13:08:25 -06:00
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
import { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
import { ThemeService } from '../../services/theme.service';
@Component({
selector: 'app-theme-selector',
templateUrl: './theme-selector.component.html',
styleUrls: ['./theme-selector.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush
})
export class ThemeSelectorComponent implements OnInit {
themeForm: UntypedFormGroup;
2024-04-09 16:15:05 +09:00
themes = ['default', 'contrast', 'wiz'];
2023-01-02 13:08:25 -06:00
constructor(
private formBuilder: UntypedFormBuilder,
private themeService: ThemeService,
) { }
ngOnInit() {
this.themeForm = this.formBuilder.group({
theme: ['default']
});
this.themeForm.get('theme')?.setValue(this.themeService.theme);
}
changeTheme() {
const newTheme = this.themeForm.get('theme')?.value;
this.themeService.apply(newTheme);
}
}