From 335543d369de2190a8a0591553117ea525ba1380 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A1n=20Oliva?= Date: Wed, 17 May 2023 21:38:31 -0600 Subject: Moved `ToDo.jsx` file into main folder. --- src/ToDo.jsx | 239 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 239 insertions(+) create mode 100644 src/ToDo.jsx (limited to 'src/ToDo.jsx') diff --git a/src/ToDo.jsx b/src/ToDo.jsx new file mode 100644 index 0000000..6ae8311 --- /dev/null +++ b/src/ToDo.jsx @@ -0,0 +1,239 @@ +import React, { useState } from "react"; +import { useSelector, useDispatch } from "react-redux"; +import { add_todo, select_todos } from "./features/todo/reducer"; + +export function NewToDo() { + const my_todos = useSelector(select_todos); + + const dispatch = useDispatch(); + const [new_text, set_new_text] = useState(""); + const [new_done, set_new_done] = useState(false); + const [new_priority, set_new_priority] = useState("Low"); + + function handle_exit_modal() { + // https://stackoverflow.com/questions/27826381/clearing-form-input-fields-in-bootstrap + $("form").get(0).reset(); // Reset form + + set_new_text(""); + set_new_done(false); + set_new_priority("Low"); + } + + return ( + <> +
+ +
+ + + + ); +} + +export function ListToDos() { + const my_todos = useSelector(select_todos); + + return ( +
+ + + + + + + + + + + + {my_todos.map((item) => ( + + + + + + + + ))} + +
#NamePriorityDue DateActions
+
+ +
+
{item.text}{item.priority}{item.due_date} +
+ + +
+
+
+ ); +} -- cgit v1.2.3