fix(dashboard): improve dropdowns for electricity and traffic charts

This commit is contained in:
KostyaDanovsky 2017-08-29 15:55:09 +03:00
parent f7a61ee809
commit 479ca11ede
2 changed files with 12 additions and 2 deletions

View file

@ -42,7 +42,8 @@
</div>
<div ngbDropdown [ngClass]="{'ghost-dropdown': currentTheme == 'default'}">
<button type="button" class="btn btn-primary" ngbDropdownToggle>
<button type="button" ngbDropdownToggle class="btn"
[ngClass]="{ 'btn-success': currentTheme == 'default', 'btn-primary': currentTheme != 'default'}">
{{ type }}
</button>
<ul class="dropdown-menu">

View file

@ -1,4 +1,5 @@
import { Component } from '@angular/core';
import { NbThemeService } from '@nebular/theme';
@Component({
selector: 'ngx-traffic',
@ -8,7 +9,8 @@ import { Component } from '@angular/core';
<nb-card-header>
<span>Traffic Consumption</span>
<div class="ghost-dropdown" ngbDropdown>
<button type="button" class="btn btn-sm btn-primary" ngbDropdownToggle>
<button type="button" class="btn btn-sm" ngbDropdownToggle
[ngClass]="{ 'btn-success': currentTheme == 'default', 'btn-primary': currentTheme != 'default'}">
{{ type }}
</button>
<ul class="dropdown-menu">
@ -25,4 +27,11 @@ import { Component } from '@angular/core';
export class TrafficComponent {
type: string = 'month';
types = ['week', 'month', 'year'];
currentTheme: string;
constructor(private themeService: NbThemeService) {
this.themeService.getJsTheme().subscribe(theme => {
this.currentTheme = theme.name;
});
}
}