RLH-12 | Start implementing /account page

This commit is contained in:
2024-11-04 02:11:28 +01:00
parent 68d4b82756
commit 02b8ce1655
20 changed files with 259 additions and 23 deletions

View File

@@ -0,0 +1,7 @@
<button
type="button"
class="btn btn-link"
[disabled]="buttonDisabled()"
(click)="button.click()">
{{button.text}}
</button>

View File

@@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ButtonComponent } from './button.component';
describe('ButtonComponent', () => {
let component: ButtonComponent;
let fixture: ComponentFixture<ButtonComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [ButtonComponent]
})
.compileComponents();
fixture = TestBed.createComponent(ButtonComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@@ -0,0 +1,40 @@
import {booleanAttribute, Component, Input, OnInit} from '@angular/core';
import {ButtonModel} 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: () => {}
};
buttonDisabled: () => boolean = () => {
return false;
// tslint:disable-next-line: semicolon
};
ngOnInit() {
this.button.disabled = this.button.disabled
? this.button.disabled
: () => false;
//
setTimeout(() => {
this.buttonDisabled = () => {
return this.button.disabled();
};
});
}
}

View File

@@ -0,0 +1,5 @@
export class ButtonModel {
text: string = "text";
disabled: () => boolean;
click: () => void;
}