Refactored layout service

This commit is contained in:
Cagatay Civici
2022-08-23 12:36:54 +03:00
parent 71888a54e5
commit 104b40f85a
6 changed files with 38 additions and 53 deletions

View File

@@ -48,12 +48,6 @@ import { LayoutService } from './service/app.layout.service';
state('expanded', style({
height: '*'
})),
state('hidden', style({
display: 'none'
})),
state('visible', style({
display: 'block'
})),
transition('collapsed <=> expanded', animate('400ms cubic-bezier(0.86, 0, 0.07, 1)'))
])
]
@@ -133,25 +127,13 @@ export class AppMenuitemComponent implements OnInit, OnDestroy {
// toggle active state
if (this.item.items) {
this.active = !this.active;
if (this.root && this.active) {
this.layoutService.onOverlaySubmenuOpen();
}
}
else {
if (this.layoutService.isMobile()) {
this.layoutService.state.staticMenuMobileActive = false;
}
}
this.menuService.onMenuStateChange({ key: this.key });
}
get submenuAnimation() {
if (this.layoutService.isDesktop() && this.layoutService.isSlim())
return this.active ? 'visible' : 'hidden';
else
return this.root ? 'expanded' : (this.active ? 'expanded' : 'collapsed');
return this.root ? 'expanded' : (this.active ? 'expanded' : 'collapsed');
}
ngOnDestroy() {