1- import { Component } from '@angular/core' ;
1+ import { Component , OnInit } from '@angular/core' ;
22import { Observable } from 'rxjs' ;
33import { MenuService } from '../shared/menu/menu.service' ;
44import { MenuID } from '../shared/menu/menu-id.model' ;
5+ import { HostWindowService } from '../shared/host-window.service' ;
56
67/**
78 * Represents the header with the logo and simple navigation
@@ -11,20 +12,25 @@ import { MenuID } from '../shared/menu/menu-id.model';
1112 styleUrls : [ 'header.component.scss' ] ,
1213 templateUrl : 'header.component.html' ,
1314} )
14- export class HeaderComponent {
15+ export class HeaderComponent implements OnInit {
1516 /**
1617 * Whether user is authenticated.
1718 * @type {Observable<string> }
1819 */
1920 public isAuthenticated : Observable < boolean > ;
20- public showAuth = false ;
21+ public isXsOrSm$ : Observable < boolean > ;
2122 menuID = MenuID . PUBLIC ;
2223
2324 constructor (
24- private menuService : MenuService
25+ protected menuService : MenuService ,
26+ protected windowService : HostWindowService ,
2527 ) {
2628 }
2729
30+ ngOnInit ( ) : void {
31+ this . isXsOrSm$ = this . windowService . isXsOrSm ( ) ;
32+ }
33+
2834 public toggleNavbar ( ) : void {
2935 this . menuService . toggleMenu ( this . menuID ) ;
3036 }
0 commit comments