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/App.jsx | 2 +- src/ToDo-UI/ToDo.jsx | 233 +++++++++++++++++++++++++++++++++++++++++++++ src/features/todo/ToDo.jsx | 233 --------------------------------------------- 3 files changed, 234 insertions(+), 234 deletions(-) create mode 100644 src/ToDo-UI/ToDo.jsx delete mode 100644 src/features/todo/ToDo.jsx diff --git a/src/App.jsx b/src/App.jsx index 625d6ae..682a1b1 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -1,7 +1,7 @@ import React from "react"; // import { Counter } from "./features/counter/Counter"; import { Search } from "./ToDo-UI/Search"; -import { Reducer } from "./features/todo/ToDo"; +import { Reducer } from "./ToDo-UI/ToDo"; function App() { return ( 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} +
+ + +
+
+
+ + ); +} diff --git a/src/features/todo/ToDo.jsx b/src/features/todo/ToDo.jsx deleted file mode 100644 index c956ba1..0000000 --- a/src/features/todo/ToDo.jsx +++ /dev/null @@ -1,233 +0,0 @@ -import React, { useState } from "react"; -import { useSelector, useDispatch } from "react-redux"; -import { add_todo, select_todos } from "./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