feat(dashboard): add logic for temperature dragger

This commit is contained in:
KostyaDanovsky 2017-07-07 19:54:49 +03:00
parent ce8055ca84
commit 2ed871ff20
13 changed files with 262 additions and 47 deletions

View file

@ -0,0 +1,11 @@
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({ name: 'ngxCapitalize' })
export class CapitalizePipe implements PipeTransform {
transform(input: string): string {
return input && input.length
? (input.charAt(0).toUpperCase() + input.slice(1).toLowerCase())
: input;
}
}

View file

@ -0,0 +1,3 @@
export * from './capitalize.pipe';
export * from './plural.pipe';
export * from './round.pipe';

View file

@ -0,0 +1,14 @@
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({ name: 'ngxPlural' })
export class PluralPipe implements PipeTransform {
transform(input: number, label: string, pluralLabel: string = ''): string {
input = input || 0;
return input === 1
? `${input} ${label}`
: pluralLabel
? `${input} ${pluralLabel}`
: `${input} ${label}s`;
}
}

View file

@ -0,0 +1,9 @@
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({ name: 'ngxRound' })
export class RoundPipe implements PipeTransform {
transform(input: number): number {
return Math.round(input);
}
}

View file

@ -21,6 +21,13 @@ import {
TinyMCEComponent,
} from './components';
import {
CapitalizePipe,
PluralPipe,
RoundPipe,
} from './pipes';
import { OneColumnLayoutComponent } from './layouts';
const BASE_MODULES = [
@ -48,20 +55,27 @@ const COMPONENTS = [
OneColumnLayoutComponent,
];
const PIPES = [
CapitalizePipe,
PluralPipe,
RoundPipe,
];
@NgModule({
imports: [
...BASE_MODULES,
...NGA_MODULES,
// TODO:
NgaSidebarModule.forRoot(),
],
exports: [
...BASE_MODULES,
...NGA_MODULES,
...COMPONENTS,
...PIPES,
],
declarations: [
...COMPONENTS,
...PIPES,
],
})
export class ThemeModule {