mirror of
https://github.com/Terncode/pixel.horse.git
synced 2026-09-24 13:55:04 +02:00
24 lines
627 B
TypeScript
24 lines
627 B
TypeScript
import { Component, Input, Output, EventEmitter, ChangeDetectionStrategy } from '@angular/core';
|
|
import { faCheck } from '../../../client/icons';
|
|
|
|
@Component({
|
|
standalone: false,
|
|
selector: 'check-box',
|
|
templateUrl: 'check-box.pug',
|
|
styleUrls: ['check-box.scss'],
|
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
})
|
|
export class CheckBox {
|
|
@Input() icon = faCheck;
|
|
@Input() label?: string;
|
|
@Input() disabled = false;
|
|
@Input() checked = false;
|
|
@Output() checkedChange = new EventEmitter<boolean>();
|
|
toggle() {
|
|
if (!this.disabled) {
|
|
this.checked = !this.checked;
|
|
this.checkedChange.emit(this.checked);
|
|
}
|
|
}
|
|
}
|