import { Component, OnInit } from '@angular/core';
import { TodoEditComponent } from '../../component/todo-edit/todo-edit.component';
import {
  IonButtons,
  IonCard,
  IonCheckbox,
  IonContent,
  IonHeader,
  IonInput,
  IonItem,
  IonList,
  IonTitle,
  IonToolbar,
} from '@ionic/angular/standalone';

@Component({
  selector: 'app-todolist-page',
  templateUrl: './todolist-page.component.html',
  styleUrls: ['./todolist-page.component.scss'],
  standalone: true,
  imports: [
    TodoEditComponent,
    IonCard,
    IonList,
    IonItem,
    IonCheckbox,
    IonInput,
    IonContent,
    IonHeader,
    IonTitle,
    IonToolbar,
    IonButtons,
  ],
})
export class TodolistPageComponent implements OnInit {
  constructor() {}
  ngOnInit() {}

  todolist: Array<string> = ['have a good day'];
  changeTodolist(ev: any) {
    this.todolist = ev;
  }
  deleteThisTodolist(todo: string) {
    let idx = this.todolist.findIndex((item) => item === todo);
    this.todolist.splice(idx, 1);
  }
}
