import { Component, OnInit,Input } from '@angular/core';
import { Store, Action } from '@ngrx/store';
import * as appReducers from '../../reducers/app-common.reducer';
import * as  commonActions  from '../../actions/app-common.actions';

@Component({
    selector: 'fm-menu-background',
    templateUrl: './menu-background.component.html',
    styleUrls: ['./menu-background.component.scss'],
})
export class MenuBackgroundComponent implements OnInit {
    @Input() visible = false;
    constructor(private store: Store<appReducers.State>) { }

    ngOnInit() { }

    handleOnClick(event:MouseEvent) {
        if(this.visible) {
            this.store.dispatch(new commonActions.SetMenuVisible(false));
            event.stopPropagation();
        }
    }
}
