ngx-admin/docs/app/pages/home/main-info-section/main-info-section.component.ts

46 lines
1.3 KiB
TypeScript
Raw Normal View History

2019-07-16 08:38:11 +03:00
/**
* @license
* Copyright Akveo. All Rights Reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*/
import { Component, OnDestroy, Input } from '@angular/core';
2019-07-16 08:38:11 +03:00
import { NbMediaBreakpoint, NbMediaBreakpointsService, NbThemeService } from '@nebular/theme';
import { takeWhile } from 'rxjs/operators';
@Component({
selector: 'ngx-landing-main-info',
templateUrl: './main-info-section.component.html',
styleUrls: ['./main-info-section.component.scss'],
})
export class MainInfoSectionComponent implements OnDestroy {
constructor(themeService: NbThemeService,
breakpointService: NbMediaBreakpointsService) {
this.breakpoints = breakpointService.getBreakpointsMap();
themeService.onMediaQueryChange()
2019-07-16 08:38:11 +03:00
.pipe(takeWhile(() => this.alive))
.subscribe(([oldValue, newValue]) => {
this.breakpoint = newValue;
});
}
private alive = true;
2020-03-25 22:10:12 +03:00
public forMaterialTheme: boolean = false;
public readonly breakpoints: any;
public breakpoint: NbMediaBreakpoint;
@Input() public set material(value: any) {
2020-03-23 15:29:27 +03:00
this.forMaterialTheme = (value);
}
public get imageUrl(): string {
return this.forMaterialTheme !== false
2020-04-02 11:41:41 +03:00
? 'assets/img/ngx-admin-material.jpg'
2020-03-26 13:21:49 +03:00
: 'assets/img/ngx-admin.png';
}
public ngOnDestroy() {
2019-07-16 08:38:11 +03:00
this.alive = false;
}
}