mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-05-12 17:04:46 +00:00
[ACA-1216] Sidenav - hide in preview (#238)
* hide sidebar in preview * indentation
This commit is contained in:
parent
2285856c14
commit
4d6e1cba1b
@ -1,5 +1,6 @@
|
|||||||
<mat-sidenav-container>
|
<mat-sidenav-container>
|
||||||
<mat-sidenav
|
<mat-sidenav
|
||||||
|
[ngClass]="{ 'sidenav--hide': hideSidenav }"
|
||||||
[@miniSidenavAnimation]="sidenavAnimationState"
|
[@miniSidenavAnimation]="sidenavAnimationState"
|
||||||
[opened]="!mobileQuery.matches"
|
[opened]="!mobileQuery.matches"
|
||||||
[mode]="mobileQuery.matches ? 'over' : 'side'">
|
[mode]="mobileQuery.matches ? 'over' : 'side'">
|
||||||
|
@ -18,6 +18,10 @@ ng-content {
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sidenav--hide {
|
||||||
|
visibility: hidden !important;
|
||||||
|
}
|
||||||
|
|
||||||
.mat-sidenav-container {
|
.mat-sidenav-container {
|
||||||
display: block;
|
display: block;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@ -26,8 +30,6 @@ ng-content {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.mat-sidenav {
|
.mat-sidenav {
|
||||||
background: #fafafa;
|
|
||||||
border-right: 1px solid rgba(0, 0, 0, 0.07);
|
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,12 +37,11 @@ import { miniSidenavAnimation } from './animations';
|
|||||||
})
|
})
|
||||||
export class LayoutContainerComponent implements OnInit, OnDestroy {
|
export class LayoutContainerComponent implements OnInit, OnDestroy {
|
||||||
static STEP_OVER = 600;
|
static STEP_OVER = 600;
|
||||||
static COMPACT = true;
|
|
||||||
|
|
||||||
@Input() sidenavMin: number;
|
@Input() sidenavMin: number;
|
||||||
@Input() sidenavMax: number;
|
@Input() sidenavMax: number;
|
||||||
@Input() sidenavCompact: boolean = LayoutContainerComponent.COMPACT;
|
|
||||||
@Input() stepOver: number;
|
@Input() stepOver: number;
|
||||||
|
@Input() hideSidenav: boolean = false;
|
||||||
|
|
||||||
@ViewChild(MatSidenav) sidenav: MatSidenav;
|
@ViewChild(MatSidenav) sidenav: MatSidenav;
|
||||||
|
|
||||||
@ -56,7 +55,6 @@ export class LayoutContainerComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
const stepOver = this.stepOver || LayoutContainerComponent.STEP_OVER;
|
const stepOver = this.stepOver || LayoutContainerComponent.STEP_OVER;
|
||||||
|
|
||||||
this.mobileQuery = this.mediaMatcher.matchMedia(`(max-width: ${stepOver}px)`);
|
this.mobileQuery = this.mediaMatcher.matchMedia(`(max-width: ${stepOver}px)`);
|
||||||
this.mobileQuery.addListener(this.mobileQueryListener);
|
this.mobileQuery.addListener(this.mobileQueryListener);
|
||||||
this.sidenavAnimationState = { value: 'expanded', params: { width: this.sidenavMax } };
|
this.sidenavAnimationState = { value: 'expanded', params: { width: this.sidenavMax } };
|
||||||
@ -68,7 +66,7 @@ export class LayoutContainerComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
toggleMenu(): void {
|
toggleMenu(): void {
|
||||||
|
|
||||||
if (!this.mobileQuery.matches && this.sidenavCompact) {
|
if (!this.mobileQuery.matches) {
|
||||||
this.isMenuMinimized = !this.isMenuMinimized;
|
this.isMenuMinimized = !this.isMenuMinimized;
|
||||||
|
|
||||||
this.sidenavAnimationState =
|
this.sidenavAnimationState =
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
sidenavMin="70"
|
sidenavMin="70"
|
||||||
sidenavMax="320"
|
sidenavMax="320"
|
||||||
[stepOver]="600"
|
[stepOver]="600"
|
||||||
|
[hideSidenav]="isPreview"
|
||||||
class="layout__content">
|
class="layout__content">
|
||||||
|
|
||||||
<app-sidenav
|
<app-sidenav
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, OnInit, OnDestroy } from '@angular/core';
|
import { Component, OnInit, OnDestroy } from '@angular/core';
|
||||||
|
import { Router, NavigationEnd } from '@angular/router';
|
||||||
import { Subscription } from 'rxjs/Rx';
|
import { Subscription } from 'rxjs/Rx';
|
||||||
import { MinimalNodeEntryEntity } from 'alfresco-js-api';
|
import { MinimalNodeEntryEntity } from 'alfresco-js-api';
|
||||||
import { ContentService } from '@alfresco/adf-core';
|
import { ContentService } from '@alfresco/adf-core';
|
||||||
@ -36,12 +37,20 @@ import { BrowsingFilesService } from '../../common/services/browsing-files.servi
|
|||||||
})
|
})
|
||||||
export class LayoutComponent implements OnInit, OnDestroy {
|
export class LayoutComponent implements OnInit, OnDestroy {
|
||||||
node: MinimalNodeEntryEntity;
|
node: MinimalNodeEntryEntity;
|
||||||
|
isPreview: boolean = false;
|
||||||
|
|
||||||
private subscriptions: Subscription[] = [];
|
private subscriptions: Subscription[] = [];
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
|
private router: Router,
|
||||||
private contentService: ContentService,
|
private contentService: ContentService,
|
||||||
private browsingFilesService: BrowsingFilesService) {}
|
private browsingFilesService: BrowsingFilesService) {
|
||||||
|
this.router.events
|
||||||
|
.filter(event => event instanceof NavigationEnd)
|
||||||
|
.subscribe( (event: any ) => {
|
||||||
|
this.isPreview = event.urlAfterRedirects.includes('preview');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.subscriptions.concat([
|
this.subscriptions.concat([
|
||||||
|
@ -13,6 +13,9 @@ $sidenav-menu-item--icon-size: 24px;
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
background: #fafafa;
|
||||||
|
border-right: 1px solid rgba(0, 0, 0, 0.07);
|
||||||
|
height: 100%;
|
||||||
|
|
||||||
&__section:last-child {
|
&__section:last-child {
|
||||||
border-bottom: 0;
|
border-bottom: 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user