29 lines
904 B
TypeScript
29 lines
904 B
TypeScript
import {Component, computed, HostListener, OnInit, signal} from '@angular/core';
|
|
import {RouterOutlet} from '@angular/router';
|
|
import {DotBackground} from './components/dot-background/dot-background';
|
|
import {DeviceDetectionService} from './service/device-detection-service';
|
|
|
|
@Component({
|
|
selector: 'app-root',
|
|
imports: [RouterOutlet, DotBackground],
|
|
templateUrl: './app.html',
|
|
styleUrl: './app.scss'
|
|
})
|
|
export class App implements OnInit {
|
|
protected readonly title = signal('Portfolio');
|
|
protected readonly isMobile = signal(false);
|
|
protected readonly isDesktop = computed(() => !this.isMobile());
|
|
|
|
constructor(private deviceDetectionService: DeviceDetectionService) {
|
|
}
|
|
|
|
ngOnInit(): void {
|
|
this.isMobile.set(this.deviceDetectionService.mobileCheck());
|
|
}
|
|
|
|
@HostListener('window:resize')
|
|
onResize() {
|
|
this.isMobile.set(this.deviceDetectionService.mobileCheck());
|
|
}
|
|
}
|