Configure material theme, add material button and input examples

This commit is contained in:
eugene-sinitsyn 2020-03-06 14:21:17 +03:00 committed by Sergey Andrievskiy
parent 70ac56b28a
commit eaf4143731
17 changed files with 198 additions and 40 deletions

View file

@ -1,5 +1,6 @@
import { Component } from '@angular/core';
import { NbComponentShape, NbComponentSize, NbComponentStatus } from '@nebular/theme';
import { NbComponentShape, NbComponentSize, NbComponentStatus, NbThemeService } from '@nebular/theme';
import { Subscription } from 'rxjs';
@Component({
selector: 'ngx-buttons',
@ -7,7 +8,23 @@ import { NbComponentShape, NbComponentSize, NbComponentStatus } from '@nebular/t
templateUrl: './buttons.component.html',
})
export class ButtonsComponent {
statuses: NbComponentStatus[] = [ 'primary', 'success', 'info', 'warning', 'danger' ];
shapes: NbComponentShape[] = [ 'rectangle', 'semi-round', 'round' ];
sizes: NbComponentSize[] = [ 'tiny', 'small', 'medium', 'large', 'giant' ];
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();
}
}