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/App.jsx | 2 +- src/ToDo-UI/ToDo.jsx | 239 --------------------------------------------------- src/ToDo.jsx | 239 +++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 240 insertions(+), 240 deletions(-) delete mode 100644 src/ToDo-UI/ToDo.jsx create mode 100644 src/ToDo.jsx diff --git a/src/App.jsx b/src/App.jsx index 33d44ce..1a07f6f 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 { NewToDo, ListToDos } from "./ToDo-UI/ToDo"; +import { NewToDo, ListToDos } from "./ToDo"; function App() { return ( diff --git a/src/ToDo-UI/ToDo.jsx b/src/ToDo-UI/ToDo.jsx deleted file mode 100644 index ceaed49..0000000 --- a/src/ToDo-UI/ToDo.jsx +++ /dev/null @@ -1,239 +0,0 @@ -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} -
- - -
-
-
- ); -} 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