import { CommonModule } from '@angular/common';
import { Component, ContentChild, signal, TemplateRef } from '@angular/core';
import { ButtonDirective } from 'primeng/button';

@Component({
  selector: 'shared-inline-edit',
  templateUrl: './inline-edit.component.html',
  imports: [CommonModule, ButtonDirective],
})
export class InlineEditComponent {
  constructor() {}

  editMode = signal<boolean>(false);
  @ContentChild('data', { static: true }) data?: TemplateRef<any>;
  @ContentChild('field', { static: true }) field?: TemplateRef<any>;

  toggleEditMode() {
    this.editMode.set(!this.editMode());
  }
}
