From 2ff01e1a304d5309c85493e7ccec9ebd6c100d7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A1n=20Oliva?= Date: Wed, 17 May 2023 21:29:57 -0600 Subject: Moved `ToDo.jsx` to UI folder. --- src/ToDo-UI/ToDo.jsx | 233 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 233 insertions(+) create mode 100644 src/ToDo-UI/ToDo.jsx (limited to 'src/ToDo-UI/ToDo.jsx') diff --git a/src/ToDo-UI/ToDo.jsx b/src/ToDo-UI/ToDo.jsx new file mode 100644 index 0000000..51e0c97 --- /dev/null +++ b/src/ToDo-UI/ToDo.jsx @@ -0,0 +1,233 @@ +import React, { useState } from "react"; +import { useSelector, useDispatch } from "react-redux"; +import { add_todo, select_todos } from "../features/todo/reducer"; + +export function Reducer() { + 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"); + + console.log("CLEANED."); + } + + return ( + <> +
+ +
+ + +
+ + + + + + + + + + + + {my_todos.map((item) => ( + + + + + + + + ))} + +
#NamePriorityDue DateActions
+
+ +
+
{item.text}{item.priority}{item.due_date} +
+ + +
+
+
+ + ); +} -- cgit v1.2.3