mirror of
https://github.com/richard-loafle/fuse-angular.git
synced 2025-04-14 12:25:14 +00:00
52 lines
1.3 KiB
TypeScript
52 lines
1.3 KiB
TypeScript
import { Component, HostBinding, HostListener, Input, OnDestroy } from '@angular/core';
|
|
import { Subscription } from 'rxjs';
|
|
|
|
import { fuseAnimations } from '../../../../animations/index';
|
|
import { FuseConfigService } from '../../../../services/config.service';
|
|
|
|
@Component({
|
|
selector : 'fuse-nav-horizontal-collapse',
|
|
templateUrl: './nav-horizontal-collapse.component.html',
|
|
styleUrls : ['./nav-horizontal-collapse.component.scss'],
|
|
animations : fuseAnimations
|
|
})
|
|
export class FuseNavHorizontalCollapseComponent implements OnDestroy
|
|
{
|
|
onConfigChanged: Subscription;
|
|
fuseSettings: any;
|
|
isOpen = false;
|
|
|
|
@HostBinding('class') classes = 'nav-item nav-collapse';
|
|
@Input() item: any;
|
|
|
|
@HostListener('mouseenter')
|
|
open()
|
|
{
|
|
this.isOpen = true;
|
|
}
|
|
|
|
@HostListener('mouseleave')
|
|
close()
|
|
{
|
|
this.isOpen = false;
|
|
}
|
|
|
|
constructor(
|
|
private fuseConfig: FuseConfigService
|
|
)
|
|
{
|
|
this.onConfigChanged =
|
|
this.fuseConfig.onConfigChanged
|
|
.subscribe(
|
|
(newSettings) => {
|
|
this.fuseSettings = newSettings;
|
|
}
|
|
);
|
|
}
|
|
|
|
ngOnDestroy()
|
|
{
|
|
this.onConfigChanged.unsubscribe();
|
|
}
|
|
}
|