RLH-12 | Implement username changing

This commit is contained in:
2024-11-04 11:25:19 +01:00
parent c4e8e7483a
commit 1bb4d1d134
19 changed files with 1318 additions and 37 deletions

View File

@@ -1,7 +1,10 @@
<button
type="button"
class="m-1 {{classes}}"
[disabled]="isDisabled()"
(click)="button.click()">
{{ button.text }}
</button>
<ng-container *ngIf="!!button.visible && button.visible()">
<button
type="button"
class="m-1 {{classes}}"
[disabled]="isDisabled()"
(click)="button.click()">
{{ button.text }}
</button>
</ng-container>

View File

@@ -1,10 +1,13 @@
import {Component, Input, OnInit} from '@angular/core';
import {ButtonModel, ButtonType} from "./models/button.model";
import {NgIf} from "@angular/common";
@Component({
selector: 'rlh-button',
standalone: true,
imports: [],
imports: [
NgIf
],
templateUrl: './button.component.html',
styleUrl: './button.component.scss'
})
@@ -14,6 +17,7 @@ export class ButtonComponent implements OnInit
@Input() button: ButtonModel = {
text: 'text',
disabled: () => false,
visible: () => true,
click: () => {},
type: ButtonType.PRIMARY
};
@@ -26,12 +30,16 @@ export class ButtonComponent implements OnInit
this.button.disabled = this.button.disabled
? this.button.disabled
: () => false;
//
setTimeout(() => {
this.isDisabled = () => {
return this.button.disabled();
};
});
this.button.visible =
this.button.visible ?
this.button.visible : () => true;
}
get classes(): string {

View File

@@ -3,9 +3,17 @@ export class ButtonModel {
type: ButtonType;
disabled: () => boolean;
click: () => void;
visible?: () => boolean;
}
export enum ButtonType {
LINK = "btn-link",
PRIMARY = "btn-primary",
SECONDARY = "btn-secondary",
SUCCESS = "btn-success",
DANGER = "btn-danger",
WARNING = "btn-warning",
INFO = "btn-info",
LIGHT = "btn-light",
DARK = "btn-dark"
}