diff options
Diffstat (limited to 'src/angular/buttons/button.component.ts')
-rw-r--r-- | src/angular/buttons/button.component.ts | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/angular/buttons/button.component.ts b/src/angular/buttons/button.component.ts index 1f049dc..d57c5f1 100644 --- a/src/angular/buttons/button.component.ts +++ b/src/angular/buttons/button.component.ts @@ -1,16 +1,17 @@ import { Component, HostBinding, Input, OnInit } from "@angular/core"; -import { Placement } from "../common/enums"; -import template from "./button.component.html"; +import { Placement, ButtonType } from "../common/enums"; +import { IButtonComponent } from './ibutton.interface'; +import { template } from "./button.component.html"; @Component({ selector: "sdc-button", template: template }) -export class ButtonComponent implements OnInit { +export class ButtonComponent implements OnInit, IButtonComponent { @Input() public text: string; @Input() public disabled: boolean; - @Input() public type: string; + @Input() public type: ButtonType; @Input() public size: string; @Input() public preventDoubleClick: boolean; @Input() public icon_name: string; @@ -21,21 +22,18 @@ export class ButtonComponent implements OnInit { public placement = Placement; private lastClick: Date; - private iconPositionClass: string; - private iconMode: string; + public iconPositionClass: string; @HostBinding('class.sdc-button__wrapper') true; constructor() { - this.type = "primary"; + this.type = ButtonType.primary; this.size = "default"; this.disabled = false; - this.iconMode = 'primary'; } public ngOnInit(): void { this.iconPositionClass = this.icon_position ? 'sdc-icon-' + this.icon_position : ''; - this.iconMode = (this.type === "primary") ? 'info' : 'primary'; } public onClick = (e): void => { |