2020-03-06 15:01:01 +03:00
|
|
|
import { Component, OnInit, OnDestroy } from '@angular/core';
|
2020-03-06 14:21:17 +03:00
|
|
|
import { NbComponentShape, NbComponentSize, NbComponentStatus, NbThemeService } from '@nebular/theme';
|
|
|
|
|
import { Subscription } from 'rxjs';
|
2017-04-29 18:53:19 +03:00
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
|
selector: 'ngx-buttons',
|
|
|
|
|
styleUrls: ['./buttons.component.scss'],
|
|
|
|
|
templateUrl: './buttons.component.html',
|
|
|
|
|
})
|
2020-03-06 15:01:01 +03:00
|
|
|
export class ButtonsComponent implements OnInit, OnDestroy {
|
2020-03-06 14:21:17 +03:00
|
|
|
public constructor(private readonly themeService: NbThemeService) {}
|
|
|
|
|
|
|
|
|
|
private readonly subscription: Subscription = new Subscription();
|
|
|
|
|
|
|
|
|
|
public readonly statuses: NbComponentStatus[] = [ 'primary', 'success', 'info', 'warning', 'danger' ];
|
|
|
|
|
public readonly shapes: NbComponentShape[] = [ 'rectangle', 'semi-round', 'round' ];
|
|
|
|
|
public readonly sizes: NbComponentSize[] = [ 'tiny', 'small', 'medium', 'large', 'giant' ];
|
|
|
|
|
public materialThemeActivated: boolean = false;
|
|
|
|
|
|
|
|
|
|
public ngOnInit(): void {
|
|
|
|
|
this.subscription.add(this.themeService.onThemeChange().subscribe(theme => {
|
|
|
|
|
const themeName: string = theme?.name || '';
|
|
|
|
|
this.materialThemeActivated = themeName.startsWith('material');
|
|
|
|
|
}));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ngOnDestroy(): void {
|
|
|
|
|
this.subscription.unsubscribe();
|
|
|
|
|
}
|
2017-04-29 18:53:19 +03:00
|
|
|
}
|