Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | 4x 4x 4x 4x 34x 35x 34x 1x | import { ThemeService } from '../../services/theme.service';
import { ChangeDetectionStrategy, Component, computed, inject } from '@angular/core';
import { IconButtonComponent } from '@drevo-web/ui';
@Component({
selector: 'app-theme-toggle',
imports: [IconButtonComponent],
templateUrl: './theme-toggle.component.html',
styleUrl: './theme-toggle.component.scss',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class ThemeToggleComponent {
private readonly themeService = inject(ThemeService);
readonly icon = computed(() => (this.themeService.isDark() ? 'light_mode' : 'dark_mode'));
readonly tooltip = computed(() => (this.themeService.isDark() ? 'Светлая тема' : 'Темная тема'));
toggle(): void {
this.themeService.toggleTheme();
}
}
|