mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-10-08 14:51:14 +00:00
[ACA-2208] Hide app menu on swipe (#934)
* mobile: hide app menu on swipe left * check for mobile screen size * space for click out on small devices * added test * fix test
This commit is contained in:
@@ -20,7 +20,10 @@
|
||||
|
||||
<adf-sidenav-layout-navigation>
|
||||
<ng-template let-isMenuMinimized="isMenuMinimized">
|
||||
<app-sidenav [showLabel]="!isMenuMinimized()"></app-sidenav>
|
||||
<app-sidenav
|
||||
[showLabel]="!isMenuMinimized()"
|
||||
(swipeleft)="hideMenu($event)"
|
||||
></app-sidenav>
|
||||
</ng-template>
|
||||
</adf-sidenav-layout-navigation>
|
||||
|
||||
|
@@ -163,4 +163,19 @@ describe('AppLayoutComponent', () => {
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should close menu on mobile screen size', () => {
|
||||
component.minimizeSidenav = false;
|
||||
component.layout.container = {
|
||||
isMobileScreenSize: true,
|
||||
toggleMenu: () => {}
|
||||
};
|
||||
|
||||
spyOn(component.layout.container, 'toggleMenu');
|
||||
fixture.detectChanges();
|
||||
|
||||
component.hideMenu(<any>{ preventDefault: () => {} });
|
||||
|
||||
expect(component.layout.container.toggleMenu).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
@@ -152,6 +152,13 @@ export class AppLayoutComponent implements OnInit, OnDestroy {
|
||||
this.onDestroy$.complete();
|
||||
}
|
||||
|
||||
hideMenu(event: Event) {
|
||||
if (!this.minimizeSidenav && this.layout.container.isMobileScreenSize) {
|
||||
event.preventDefault();
|
||||
this.layout.container.toggleMenu();
|
||||
}
|
||||
}
|
||||
|
||||
private updateState() {
|
||||
if (this.minimizeSidenav && !this.layout.isMenuMinimized) {
|
||||
this.layout.isMenuMinimized = true;
|
||||
|
@@ -4,6 +4,14 @@
|
||||
adf-sidenav-layout {
|
||||
@include flex-column;
|
||||
|
||||
// TODO: move to ADF
|
||||
@media screen and ($mat-xsmall) {
|
||||
.mat-drawer {
|
||||
width: calc(-50px + 100vw) !important;
|
||||
max-width: 320px !important;
|
||||
}
|
||||
}
|
||||
|
||||
.mat-drawer-content {
|
||||
@include flex-column;
|
||||
overflow: auto;
|
||||
|
Reference in New Issue
Block a user