diff --git a/package-lock.json b/package-lock.json
index e6a160a..6dc47ce 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -14,6 +14,7 @@
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-scripts": "5.0.1",
+ "uuid4": "^2.0.3",
"web-vitals": "^2.1.4"
}
},
@@ -17332,6 +17333,11 @@
"uuid": "dist/bin/uuid"
}
},
+ "node_modules/uuid4": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/uuid4/-/uuid4-2.0.3.tgz",
+ "integrity": "sha512-CTpAkEVXMNJl2ojgtpLXHgz23dh8z81u6/HEPiQFOvBc/c2pde6TVHmH4uwY0d/GLF3tb7+VDAj4+2eJaQSdZQ=="
+ },
"node_modules/v8-to-istanbul": {
"version": "8.1.1",
"resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-8.1.1.tgz",
diff --git a/package.json b/package.json
index 88a269e..c84620f 100644
--- a/package.json
+++ b/package.json
@@ -9,6 +9,7 @@
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-scripts": "5.0.1",
+ "uuid4": "^2.0.3",
"web-vitals": "^2.1.4"
},
"scripts": {
diff --git a/public/index.html b/public/index.html
index aa069f2..d3c17f2 100644
--- a/public/index.html
+++ b/public/index.html
@@ -15,6 +15,12 @@
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
+
+
+
+
React App
diff --git a/src/App.css b/src/App.css
index 13088c2..d65f2ff 100644
--- a/src/App.css
+++ b/src/App.css
@@ -1,8 +1,6 @@
:root {
- --peach: #ffe6e6;
- --pink: #e1afd1;
- --lightPurple: #ad88c6;
- --darkPurple: #7469b6;
+ --one: #8b84b2;
+ --two: #dfdef0;
}
* {
@@ -11,6 +9,7 @@
.App {
text-align: center;
+ background-color: var(--one);
}
.App-logo {
@@ -25,25 +24,143 @@
}
.App-header {
- background-color: #282c34;
+ color: white;
+ font-family: "Madimi One", sans-serif;
+ /* background-color: var(--one); */
+ background-color: rgba(0, 0, 0, 0.2);
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: calc(10px + 2vmin);
- color: white;
+
+ /* color: white; */
}
-.App-link {
- color: #61dafb;
+.contenr {
+ border: 2px solid white;
+ width: 50%;
+ height: auto;
+ /* background-color: var(--two); */
+ background-image: repeating-linear-gradient(
+ 45deg,
+ rgba(0, 0, 0, 0.1),
+ transparent,
+ rgba(0, 0, 0, 0.04),
+ rgba(0, 0, 0, 0.04),
+ rgba(0, 0, 0, 0.01),
+ rgba(0, 0, 0, 0.02),
+ rgba(0, 0, 0, 0.05),
+ transparent,
+ rgba(0, 0, 0, 0.04),
+ rgba(0, 0, 0, 0.1),
+ rgba(0, 0, 0, 0.03) 3px
+ ),
+ linear-gradient(0deg, rgb(85, 159, 230), rgb(230, 105, 196));
+ border-radius: 25px;
}
-@keyframes App-logo-spin {
- from {
- transform: rotate(0deg);
- }
- to {
- transform: rotate(360deg);
- }
+.input-title {
+ font-family: "Madimi One", sans-serif;
+ width: 250px;
+ height: 35px;
+ border-radius: 15px;
+ margin: 10px;
+ border: 2px #818cf8 solid;
+ /* outline: none; */
+}
+
+.btn-add {
+ border: none;
+ outline: none;
+ background-color: #6c5ce7;
+ padding: 10px 20px;
+ font-size: 12px;
+ font-weight: 700;
+ color: #fff;
+ border-radius: 5px;
+ transition: all ease 0.1s;
+ box-shadow: 0px 5px 0px 0px #a29bfe;
+ margin-left: 5px;
+}
+
+button:active {
+ transform: translateY(5px);
+ box-shadow: 0px 0px 0px 0px #a29bfe;
+}
+.items {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ column-gap: 30px;
+ margin-left: 30px;
+}
+.items p {
+ width: 65%;
+ overflow-wrap: break-word;
+ text-align: start;
+ cursor: pointer;
+}
+.detels {
+ width: 20%;
+ display: flex;
+ justify-content: space-evenly;
+}
+.red {
+ text-decoration: line-through;
+}
+#delete-img,
+#edit-img,
+#save-img {
+ width: 30px;
+}
+.hadar {
+ width: 90%;
+ display: flex;
+ justify-content: space-evenly;
+}
+
+.search {
+ border-style: none;
+ height: 50px;
+ width: 50px;
+ padding: 10px;
+ outline: none;
+ border-radius: 50%;
+ transition: 0.5s ease-in-out;
+ background-color: #7e4fd4;
+ box-shadow: 0px 0px 3px #f3f3f3;
+ padding-right: 40px;
+ color: #fff;
+}
+
+.search::placeholder {
+ color: #8f8f8f;
+}
+
+.icon {
+ display: flex;
+ align-items: center;
+ justify-content: end;
+ position: absolute;
+ cursor: pointer;
+ width: 50px;
+ height: 50px;
+ outline: none;
+ border-style: none;
+ border-radius: 50%;
+ pointer-events: painted;
+ background-color: transparent;
+ transition: 0.2s linear;
+}
+
+.icon:focus ~ .search,
+.search:focus {
+ box-shadow: none;
+ width: 250px;
+ border-radius: 0px;
+ background-color: transparent;
+ border-bottom: 3px solid #7e4fd4;
+ transition: all 500ms cubic-bezier(0, 0.11, 0.35, 2);
}
diff --git a/src/App.js b/src/App.js
index 0ff7d8a..70efe55 100644
--- a/src/App.js
+++ b/src/App.js
@@ -1,4 +1,6 @@
import "./App.css";
+import ToDoList from "./components/ToDoList";
+import todoData from "./todoData";
// TODO: Import the todoData and pass it as a prop to the TodoList component
function App() {
@@ -6,7 +8,9 @@ function App() {
{/* Call the TodoList Component Here */}
-
+
+
+ {" "}
);
}
diff --git a/src/components/ListTask.jsx b/src/components/ListTask.jsx
new file mode 100644
index 0000000..a5076ef
--- /dev/null
+++ b/src/components/ListTask.jsx
@@ -0,0 +1,13 @@
+const ListTask = ({ filterTodo, getToDo }) => {
+ return (
+
+ );
+};
+
+export default ListTask;
diff --git a/src/components/ToDoList.jsx b/src/components/ToDoList.jsx
new file mode 100644
index 0000000..6625e80
--- /dev/null
+++ b/src/components/ToDoList.jsx
@@ -0,0 +1,97 @@
+import { useState, useRef } from "react";
+import uuid4 from "uuid4";
+import TodoItem from "./TodoItem";
+import ListTask from "./ListTask";
+
+function ToDoList({ todoData }) {
+ const [copyToDo, setcopyToDo] = useState(todoData);
+ const [getToDo, setToDo] = useState(todoData);
+ const [todoTitel, setToDoTitel] = useState("");
+ const [search, setSearch] = useState("");
+ const inputTitel = useRef();
+ console.log("hi word");
+ function handleTextChange(event) {
+ setToDoTitel(event.target.value);
+ }
+
+ function handleTodoCreate() {
+ const newToDoObj = {
+ id: uuid4(),
+ title: todoTitel,
+ done: false,
+ };
+ setToDo([...getToDo, newToDoObj]);
+ inputTitel.current.value = "";
+ }
+
+ function handleDelete(todoId) {
+ setToDo(getToDo.filter((todo) => todo.id !== todoId));
+ }
+ function handleEdit(idTodo, newText) {
+ setToDo(
+ getToDo.map((todo) =>
+ todo.id === idTodo ? { ...todo, title: newText } : todo
+ )
+ );
+ }
+
+ //###########################################
+ const filterTodo = (text) => {
+ const filterObjects = (text, todos) => {
+ if (text == 1) {
+ return todos.filter((item) => item.done == false);
+ } else if (text == 2) {
+ return todos.filter((item) => item.done == true);
+ } else {
+ return todos.slice(); // Return a copy of the original array if value is not 1 or 2
+ }
+ };
+
+ const filteredTodos = filterObjects(text, copyToDo);
+ setToDo(filteredTodos);
+ };
+ //################################
+
+ return (
+
+
+
+
+
+ setSearch(e.target.value)}
+ >
+
+
+
+
+ {getToDo
+ .filter((todo) => {
+ return search.toLowerCase() === ""
+ ? todo
+ : todo.title.toLowerCase().includes(search);
+ })
+ .map((todo, index) => (
+
+ ))}
+
+ );
+}
+export default ToDoList;
diff --git a/src/components/TodoItem.jsx b/src/components/TodoItem.jsx
new file mode 100644
index 0000000..c82372c
--- /dev/null
+++ b/src/components/TodoItem.jsx
@@ -0,0 +1,64 @@
+import React from "react";
+import { useState } from "react";
+
+function TodoItem({ todo, handleDelete, handleEdit }) {
+ const [editText, setEditText] = useState(false);
+ const [newEditText, setNewEditText] = useState(todo.title);
+ const [done, setDone] = useState(todo.done);
+ // copy text to Edit input
+ function handlEdit(event) {
+ setNewEditText(event.target.value);
+ }
+ // Edit the item
+ function Editing() {
+ handleEdit(todo.id, newEditText);
+ setEditText(false);
+ }
+ //############################ not completed
+ function handleDone() {
+ console.log("1", done);
+ setDone(!done);
+ console.log("2", done);
+ }
+
+ return (
+
+ {editText ? (
+
+ ) : (
+
+ {todo.title}
+
+ )}
+
+ {editText ? (
+
+
+
+ ) : (
+
setEditText(true)}>
+
+
+ )}
+
handleDelete(todo.id)}>
+
+
+
+
+ );
+}
+export default TodoItem;
diff --git a/src/components/stayl.css b/src/components/stayl.css
new file mode 100644
index 0000000..e69de29
diff --git a/src/index.css b/src/index.css
index ec2585e..4a1df4d 100644
--- a/src/index.css
+++ b/src/index.css
@@ -1,13 +1,13 @@
body {
margin: 0;
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
- 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
+ "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
code {
- font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
+ font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New",
monospace;
}
diff --git a/src/todoData.js b/src/todoData.js
index d12d26f..3b819af 100644
--- a/src/todoData.js
+++ b/src/todoData.js
@@ -17,7 +17,7 @@ const todoData = [
{
id: 4,
title: "Write a book",
- done: false,
+ done: true,
},
{
id: 5,