Skip to content

Commit

Permalink
➕ feat: modal check
Browse files Browse the repository at this point in the history
  • Loading branch information
Linder Hassinger committed Apr 11, 2024
1 parent 12a2243 commit e7d758a
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion semana-9/todolist/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export default function App() {
// Es para manejar el estado del modal
const [isOpen, setIsOpen] = useState(false);
const [isOpenDelete, setIsOpenDelete] = useState(false);
const [isOpenCheck, setIsOpenCheck] = useState(false);
// Creamos una variable para saber a que tarea le dimos click
const [currentTask, setCurrentTask] = useState(null);

Expand Down Expand Up @@ -38,6 +39,11 @@ export default function App() {
setIsOpenDelete(true);
};

const handleCurrentCheckTask = (task) => {
setCurrentTask(task);
setIsOpenCheck(true);
};

const handleUpdateTask = (task, newText) => {
// Paso1: Buscar la tarea en mi lista
const searchTask = listTasks.find((element) => element.id === task.id);
Expand Down Expand Up @@ -73,7 +79,7 @@ export default function App() {
>
<p>{task.text}</p>
<div className="flex gap-5">
<button></button>
<button onClick={() => handleCurrentCheckTask(task)}></button>
{/* <button onClick={function () {
handleCurrentTask(task)
}}>✏️</button> */}
Expand Down Expand Up @@ -106,6 +112,15 @@ export default function App() {
/>
</Modal>
)}
{currentTask && (
<Modal
open={isOpenCheck}
setIsOpen={setIsOpenCheck}
title="Check Task"
>
<p>Check task</p>
</Modal>
)}
</main>
</>
);
Expand Down

0 comments on commit e7d758a

Please sign in to comment.