import { Directive , HostListener } from '@angular/core' ; import { ObMasterLayoutComponentService } from '../master-layout/master-layout.component.service' ; import { isNotKeyboardEventOnButton } from '../../utilities' ; @ Directive ( { selector : '[obMasterLayoutHeaderToggle]' , exportAs : 'obMasterLayoutHeaderToggle' , host : { class : 'ob-master-layout-header-toggle' } } ) export class ObMasterLayoutHeaderToggleDirective { constructor ( private readonly masterLayout ) { } @ HostListener ( 'click' , [ '$event' ] ) @ HostListener ( 'keyup.enter' , [ '$event' ] ) toggle ( event ? ) { if ( isNotKeyboardEventOnButton ( event ) ) { event . preventDefault ( ) ; this . masterLayout . isMenuOpened = ! this . masterLayout . isMenuOpened ; } } }