one-column.layout.ts 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import { Component, OnDestroy } from '@angular/core';
  2. import { NbThemeService } from '@nebular/theme';
  3. import { takeWhile } from 'rxjs/operators';
  4. // TODO: move layouts into the framework
  5. @Component({
  6. selector: 'ngx-one-column-layout',
  7. styleUrls: ['./one-column.layout.scss'],
  8. template: `
  9. <nb-layout>
  10. <nb-layout-header fixed>
  11. <ngx-header></ngx-header>
  12. </nb-layout-header>
  13. <nb-sidebar class="menu-sidebar" tag="menu-sidebar" responsive>
  14. <nb-sidebar-header *ngIf="currentTheme !== 'corporate'">
  15. </nb-sidebar-header>
  16. <ng-content select="nb-menu"></ng-content>
  17. </nb-sidebar>
  18. <nb-layout-column>
  19. <ng-content select="router-outlet"></ng-content>
  20. </nb-layout-column>
  21. <nb-layout-footer fixed>
  22. <ngx-footer></ngx-footer>
  23. </nb-layout-footer>
  24. </nb-layout>
  25. `,
  26. })
  27. export class OneColumnLayoutComponent implements OnDestroy {
  28. private alive = true;
  29. currentTheme: string;
  30. constructor(protected themeService: NbThemeService) {
  31. this.themeService.getJsTheme()
  32. .pipe(takeWhile(() => this.alive))
  33. .subscribe(theme => {
  34. this.currentTheme = theme.name;
  35. });
  36. }
  37. ngOnDestroy() {
  38. this.alive = false;
  39. }
  40. }