ngx-admin/src/app/@theme/layouts/one-column/one-column.layout.ts

52 lines
1.4 KiB
TypeScript
Raw Normal View History

import { Component, OnDestroy } from '@angular/core';
import { NbThemeService } from '@nebular/theme';
import { takeWhile } from 'rxjs/operators';
2017-04-13 14:24:23 +03:00
2017-06-08 23:18:11 +03:00
// TODO: move layouts into the framework
2017-04-13 14:24:23 +03:00
@Component({
2017-05-06 15:35:15 +03:00
selector: 'ngx-one-column-layout',
styleUrls: ['./one-column.layout.scss'],
2017-04-13 14:24:23 +03:00
template: `
<nb-layout>
<nb-layout-header fixed>
<ngx-header></ngx-header>
</nb-layout-header>
2017-04-17 19:01:47 +03:00
<nb-sidebar class="menu-sidebar" tag="menu-sidebar" responsive>
<nb-sidebar-header *ngIf="currentTheme !== 'corporate'">
<a href="#" class="btn btn-hero-success main-btn">
2017-07-26 20:39:12 +03:00
<i class="ion ion-social-github"></i> <span>Support Us</span>
</a>
</nb-sidebar-header>
<ng-content select="nb-menu"></ng-content>
</nb-sidebar>
2017-04-18 15:45:49 +03:00
<nb-layout-column>
<ng-content select="router-outlet"></ng-content>
</nb-layout-column>
2017-04-18 15:45:49 +03:00
<nb-layout-footer fixed>
<ngx-footer></ngx-footer>
</nb-layout-footer>
</nb-layout>
2017-04-13 14:24:23 +03:00
`,
})
export class OneColumnLayoutComponent implements OnDestroy {
private alive = true;
currentTheme: string;
constructor(protected themeService: NbThemeService) {
this.themeService.getJsTheme()
.pipe(takeWhile(() => this.alive))
.subscribe(theme => {
this.currentTheme = theme.name;
});
}
ngOnDestroy() {
this.alive = false;
}
2017-04-13 14:24:23 +03:00
}