Files
NowChess-Frontend/src/app/components/input-card/input-card.component.ts
T

34 lines
967 B
TypeScript

import { Component, Input, Output, EventEmitter } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
@Component({
selector: 'app-input-card',
standalone: true,
imports: [CommonModule, FormsModule],
templateUrl: './input-card.component.html',
styleUrl: './input-card.component.css',
})
export class InputCardComponent {
@Input() label: string = '';
@Input() placeholder: string = '';
@Input() buttonLabel: string = 'Send';
@Input() inputType: 'input' | 'textarea' = 'input';
@Input() value: string = '';
@Input() cardClass: string = '';
@Input() hintText: string = '';
@Input() rows: number = 4;
@Output() valueChange = new EventEmitter<string>();
@Output() buttonClick = new EventEmitter<void>();
onValueChange(newValue: string): void {
this.value = newValue;
this.valueChange.emit(newValue);
}
onButtonClick(): void {
this.buttonClick.emit();
}
}