({
items,
handleSelectionChange,
handleDelete,
handleEdit,
}: {
items: TodoItemType[];
handleSelectionChange: (event: CustomEvent<ListSelectionChangeEventDetail>) => void;
handleDelete: (id: number) => void;
handleEdit: (id: number) => void;
})
| 6 | import { TodoItem as TodoItemType } from "../types"; |
| 7 | |
| 8 | function TodoList({ |
| 9 | items, |
| 10 | handleSelectionChange, |
| 11 | handleDelete, |
| 12 | handleEdit, |
| 13 | }: { |
| 14 | items: TodoItemType[]; |
| 15 | handleSelectionChange: (event: CustomEvent<ListSelectionChangeEventDetail>) => void; |
| 16 | handleDelete: (id: number) => void; |
| 17 | handleEdit: (id: number) => void; |
| 18 | }) { |
| 19 | const list = useRef<List>(); |
| 20 | |
| 21 | useEffect(() => { |
| 22 | const currentList = list.current; |
| 23 | |
| 24 | currentList?.addEventListener("selection-change", handleSelectionChange as EventListener); |
| 25 | return () => { |
| 26 | currentList?.removeEventListener("selection-change", handleSelectionChange as EventListener); |
| 27 | }; |
| 28 | }, [handleSelectionChange]); |
| 29 | |
| 30 | return ( |
| 31 | <ui5-list id="todo-list" selection-mode="Multiple" ref={list}> |
| 32 | {items.map((todo) => { |
| 33 | return <TodoItem key={todo.id} id={todo.id} text={todo.text} deadline={todo.deadline} done={todo.done} handleDelete={handleDelete} handleEdit={handleEdit}></TodoItem>; |
| 34 | })} |
| 35 | </ui5-list> |
| 36 | ); |
| 37 | } |
| 38 | |
| 39 | export default TodoList; |
nothing calls this directly
no outgoing calls
no test coverage detected