mirror of
https://github.com/akveo/ngx-admin.git
synced 2025-12-29 21:58:49 +01:00
refactor(room): hide background grid in corporate theme
This commit is contained in:
parent
74747a57a6
commit
25711b71e9
1 changed files with 32 additions and 3 deletions
|
|
@ -1,15 +1,22 @@
|
|||
import { Component, EventEmitter, Output } from '@angular/core';
|
||||
import { Component, EventEmitter, HostBinding, OnDestroy, OnInit, Output } from '@angular/core';
|
||||
import { Location, LocationStrategy } from '@angular/common';
|
||||
import { NbThemeService } from '@nebular/theme';
|
||||
import { map, takeUntil } from 'rxjs/operators';
|
||||
import { Subject } from 'rxjs';
|
||||
|
||||
@Component({
|
||||
selector: 'ngx-room-selector',
|
||||
templateUrl: './room-selector.component.html',
|
||||
styleUrls: ['./room-selector.component.scss'],
|
||||
})
|
||||
export class RoomSelectorComponent {
|
||||
export class RoomSelectorComponent implements OnInit, OnDestroy {
|
||||
|
||||
private destroy$ = new Subject<void>();
|
||||
private hideGrid: boolean;
|
||||
|
||||
@Output() select: EventEmitter<number> = new EventEmitter();
|
||||
|
||||
selectedRoom: null;
|
||||
selectedRoom = null;
|
||||
sortedRooms = [];
|
||||
viewBox = '-20 -20 618.88 407.99';
|
||||
isIE = !!(navigator.userAgent.match(/Trident/)
|
||||
|
|
@ -59,13 +66,35 @@ export class RoomSelectorComponent {
|
|||
],
|
||||
};
|
||||
|
||||
@HostBinding('style.background')
|
||||
get background(): 'none' | null {
|
||||
return this.hideGrid ? 'none' : null;
|
||||
}
|
||||
|
||||
constructor(
|
||||
private location: Location,
|
||||
private locationStrategy: LocationStrategy,
|
||||
private themeService: NbThemeService,
|
||||
) {
|
||||
this.selectRoom('2');
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.hideGrid = this.themeService.currentTheme === 'corporate';
|
||||
|
||||
this.themeService.onThemeChange()
|
||||
.pipe(
|
||||
map(({ name }) => name === 'corporate'),
|
||||
takeUntil(this.destroy$),
|
||||
)
|
||||
.subscribe((hideGrid: boolean) => this.hideGrid = hideGrid);
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.destroy$.next();
|
||||
this.destroy$.complete();
|
||||
}
|
||||
|
||||
private sortRooms() {
|
||||
this.sortedRooms = this.roomSvg.rooms.slice(0).sort((a, b) => {
|
||||
if (a.id === this.selectedRoom) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue