From 16344f61304ef1f59b84243b80e1112b9427c12e Mon Sep 17 00:00:00 2001 From: Thomas Renger Date: Sat, 23 Dec 2023 19:42:10 +0100 Subject: [PATCH] feat: simplify the usage --- .../src/lib/components/button/button.component.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/projects/components/src/lib/components/button/button.component.ts b/projects/components/src/lib/components/button/button.component.ts index ecd81a0..1736f1d 100644 --- a/projects/components/src/lib/components/button/button.component.ts +++ b/projects/components/src/lib/components/button/button.component.ts @@ -15,15 +15,15 @@ import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; }) export class ButtonComponent { @Input({ required: true }) type!: 'raised' | 'stroked'; + @Input({ required: true }) function!: () => Promise | void; + @Input({ required: false }) color: 'primary' | 'accent' | 'warn' = 'primary'; - @Input({ required: false }) loading = false; - @Input({ required: false }) function: () => Promise | void = () => { - }; + protected loading = false; protected async click(): Promise { this.loading = true; - await (this.function ? this.function() : Promise.resolve()); + await this.function(); this.loading = false; } }