import React from 'react'
import { todo } from '../../types.dt'
import Item from './Item'

const List = ({ Todo, handleDelete, handleUpdate }: { Todo: todo[], handleDelete: () => void, handleUpdate: () => void }) => {
    console.log(Todo)
    return (
        <div className='wrapper-list'>
            {
                Todo.length === 0 && <h1 className='alert'>Nothing in this todo</h1>
            }
            {
                Todo.map((item, index) => {
                    return (
                        <Item {...item} index={index} key={item.id} handleDelete={handleDelete} handleUpdate={handleUpdate} />
                    )
                })
            }
        </div>
    )
}

export default List