Add material menu icon for material themes

This commit is contained in:
eugene-sinitsyn 2020-03-06 15:47:34 +03:00
parent a0af66a5d0
commit 0e4cee0a6a
6 changed files with 43 additions and 44 deletions

View file

@ -120,7 +120,7 @@
</nb-card-body>
</nb-card>
<nb-card *ngIf="materialThemeActivated">
<nb-card *ngIf="materialTheme$ | async">
<nb-card-body>
<ngx-material-buttons></ngx-material-buttons>
</nb-card-body>

View file

@ -1,30 +1,26 @@
import { Component, OnInit, OnDestroy } from '@angular/core';
import { Component } from '@angular/core';
import { NbComponentShape, NbComponentSize, NbComponentStatus, NbThemeService } from '@nebular/theme';
import { Subscription } from 'rxjs';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
@Component({
selector: 'ngx-buttons',
styleUrls: ['./buttons.component.scss'],
templateUrl: './buttons.component.html',
})
export class ButtonsComponent implements OnInit, OnDestroy {
public constructor(private readonly themeService: NbThemeService) {}
export class ButtonsComponent {
public constructor(private readonly themeService: NbThemeService) {
this.materialTheme$ = this.themeService.onThemeChange()
.pipe(map(theme => {
const themeName: string = theme?.name || '';
return themeName.startsWith('material');
}));
}
private readonly subscription: Subscription = new Subscription();
public readonly materialTheme$: Observable<boolean>;
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();
}
}

View file

@ -85,7 +85,7 @@
</nb-card>
</div>
</div>
<div *ngIf="materialThemeActivated" class="row">
<div *ngIf="materialTheme$ | async" class="row">
<div class="col-lg-12">
<ngx-material-inputs></ngx-material-inputs>
</div>

View file

@ -1,30 +1,25 @@
import { Component, OnDestroy, OnInit } from '@angular/core';
import { Component } from '@angular/core';
import { NbThemeService } from '@nebular/theme';
import { Subscription } from 'rxjs';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
@Component({
selector: 'ngx-form-inputs',
styleUrls: ['./form-inputs.component.scss'],
templateUrl: './form-inputs.component.html',
})
export class FormInputsComponent implements OnInit, OnDestroy {
public constructor(private readonly themeService: NbThemeService) {}
export class FormInputsComponent {
public constructor(private readonly themeService: NbThemeService) {
this.materialTheme$ = this.themeService.onThemeChange()
.pipe(map(theme => {
const themeName: string = theme?.name || '';
return themeName.startsWith('material');
}));
}
private readonly subscription: Subscription = new Subscription();
public readonly materialTheme$: Observable<boolean>;
public materialThemeActivated: boolean = false;
public starRate: number = 2;
public heartRate: number = 4;
public radioGroupValue: string = 'This is value 2';
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();
}
}