import {Component, Input, OnInit} from '@angular/core'; import {ButtonModel, ButtonType} from "./models/button.model"; @Component({ selector: 'rlh-button', standalone: true, imports: [], templateUrl: './button.component.html', styleUrl: './button.component.scss' }) export class ButtonComponent implements OnInit { @Input() button: ButtonModel = { text: 'text', disabled: () => false, click: () => {}, type: ButtonType.PRIMARY }; isDisabled: () => boolean = () => { return false; }; ngOnInit() { this.button.disabled = this.button.disabled ? this.button.disabled : () => false; // setTimeout(() => { this.isDisabled = () => { return this.button.disabled(); }; }); } get classes(): string { let classes = 'btn'; classes += ' ' + (this.button.type ? this.button.type : ButtonType.PRIMARY); return classes; } }