Skip to content

Commit

Permalink
Lint code
Browse files Browse the repository at this point in the history
  • Loading branch information
PowerKiKi committed Jun 21, 2018
1 parent cf88fb8 commit 09fc3a4
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 21 deletions.
31 changes: 16 additions & 15 deletions projects/fab-speed-dial/src/lib/fab-speed-dial.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
} from '@angular/core';
import { MatButton } from '@angular/material';

const Z_INDEX_ITEM: number = 23;
const Z_INDEX_ITEM = 23;

export type Direction = 'up' | 'down' | 'left' | 'right';
export type AnimationMode = 'fling' | 'scale';
Expand Down Expand Up @@ -45,7 +45,7 @@ export class EcoFabSpeedDialActionsComponent implements AfterContentInit {
this._buttons.toArray().forEach((button, i) => {
this.renderer.addClass(button._getHostElement(), 'eco-fab-action-item');
this.changeElementStyle(button._getHostElement(), 'z-index', '' + (Z_INDEX_ITEM - i));
})
});
}

show() {
Expand All @@ -63,7 +63,7 @@ export class EcoFabSpeedDialActionsComponent implements AfterContentInit {
this.changeElementStyle(button._getHostElement(), 'transition-delay', transitionDelay + 'ms');
this.changeElementStyle(button._getHostElement(), 'opacity', '1');
this.changeElementStyle(button._getHostElement(), 'transform', transform);
})
});
}
}

Expand All @@ -83,14 +83,15 @@ export class EcoFabSpeedDialActionsComponent implements AfterContentInit {
this.changeElementStyle(button._getHostElement(), 'transition-delay', transitionDelay + 'ms');
this.changeElementStyle(button._getHostElement(), 'opacity', opacity);
this.changeElementStyle(button._getHostElement(), 'transform', transform);
})
});
}
}

private getTranslateFunction(value: string) {
let dir = this._parent.direction;
let translateFn = (dir === 'up' || dir === 'down') ? 'translateY' : 'translateX';
let sign = (dir === 'down' || dir === 'right') ? '-' : '';
const dir = this._parent.direction;
const translateFn = (dir === 'up' || dir === 'down') ? 'translateY' : 'translateX';
const sign = (dir === 'down' || dir === 'right') ? '-' : '';

return translateFn + '(' + sign + value + ')';
}

Expand All @@ -112,15 +113,15 @@ export class EcoFabSpeedDialActionsComponent implements AfterContentInit {
encapsulation: ViewEncapsulation.None,
})
export class EcoFabSpeedDialComponent implements AfterContentInit {
private isInitialized: boolean = false;
private isInitialized = false;
private _direction: Direction = 'up';
private _open: boolean = false;
private _open = false;
private _animationMode: AnimationMode = 'fling';

/**
* Whether this speed dial is fixed on screen (user cannot change it by clicking)
*/
@Input() fixed: boolean = false;
@Input() fixed = false;

/**
* Whether this speed dial is opened
Expand All @@ -131,7 +132,7 @@ export class EcoFabSpeedDialComponent implements AfterContentInit {
}

set open(open: boolean) {
let previousOpen = this._open;
const previousOpen = this._open;
this._open = open;
if (previousOpen !== this._open) {
this.openChange.emit(this._open);
Expand All @@ -149,7 +150,7 @@ export class EcoFabSpeedDialComponent implements AfterContentInit {
}

set direction(direction: Direction) {
let previousDirection = this._direction;
const previousDirection = this._direction;
this._direction = direction;
if (previousDirection !== this.direction) {
this._setElementClass(previousDirection, false);
Expand All @@ -169,7 +170,7 @@ export class EcoFabSpeedDialComponent implements AfterContentInit {
}

set animationMode(animationMode: AnimationMode) {
let previousAnimationMode = this._animationMode;
const previousAnimationMode = this._animationMode;
this._animationMode = animationMode;
if (previousAnimationMode !== this._animationMode) {
this._setElementClass(previousAnimationMode, false);
Expand Down Expand Up @@ -245,9 +246,9 @@ export class EcoFabSpeedDialTriggerComponent {
*/
@HostBinding('class.eco-spin') get sp() {
return this.spin;
};
}

@Input() spin: boolean = false;
@Input() spin = false;

constructor(injector: Injector) {
this._parent = injector.get(EcoFabSpeedDialComponent);
Expand Down
5 changes: 3 additions & 2 deletions projects/fab-speed-dial/tslint.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
{
"extends": "../../tslint.json",
"rules": {
"no-use-before-declare": false,
"directive-selector": [
true,
"attribute",
"lib",
"eco",
"camelCase"
],
"component-selector": [
true,
"element",
"lib",
"eco",
"kebab-case"
]
}
Expand Down
8 changes: 4 additions & 4 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ export class AppComponent {

private _fixed = false;

public open: boolean = false;
public spin: boolean = false;
public direction: string = 'up';
public animationMode: string = 'fling';
public open = false;
public spin = false;
public direction = 'up';
public animationMode = 'fling';

get fixed(): boolean {
return this._fixed;
Expand Down

0 comments on commit 09fc3a4

Please sign in to comment.