RLH-14 - Implement Button component
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import {booleanAttribute, Component, Input, OnInit} from '@angular/core';
|
||||
import {ButtonModel} from "./models/button.model";
|
||||
import {Component, Input, OnInit} from '@angular/core';
|
||||
import {ButtonModel, ButtonType} from "./models/button.model";
|
||||
|
||||
@Component({
|
||||
selector: 'rlh-button',
|
||||
@@ -14,12 +14,12 @@ export class ButtonComponent implements OnInit
|
||||
@Input() button: ButtonModel = {
|
||||
text: 'text',
|
||||
disabled: () => false,
|
||||
click: () => {}
|
||||
click: () => {},
|
||||
type: ButtonType.PRIMARY
|
||||
};
|
||||
|
||||
buttonDisabled: () => boolean = () => {
|
||||
isDisabled: () => boolean = () => {
|
||||
return false;
|
||||
// tslint:disable-next-line: semicolon
|
||||
};
|
||||
|
||||
ngOnInit() {
|
||||
@@ -28,12 +28,19 @@ export class ButtonComponent implements OnInit
|
||||
: () => false;
|
||||
//
|
||||
setTimeout(() => {
|
||||
this.buttonDisabled = () => {
|
||||
this.isDisabled = () => {
|
||||
return this.button.disabled();
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
get classes(): string {
|
||||
let classes = 'btn';
|
||||
classes += ' ' + (this.button.type ? this.button.type : ButtonType.PRIMARY);
|
||||
|
||||
return classes;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user