import { Component, computed, contentChild, input } from '@angular/core';
import { NgControl } from '@angular/forms';

@Component({
  selector: 'ui-textarea',
  templateUrl: './textarea.component.html',
  host: { '[class]': '["ui-textarea", controlEmptyClass()]' },
})
export class TextareaComponent {
  label = input<string>();

  ngControl = contentChild(NgControl);

  controlEmptyClass = computed(() => {
    return this.ngControl()?.value
      ? 'ui-textarea__not-empty'
      : 'ui-textarea__empty';
  });
}
