Projects
+Projects:
-
+
diff --git a/main.js b/main.js
index a6dfb96..fe11a1c 100644
--- a/main.js
+++ b/main.js
@@ -21,39 +21,88 @@ const projectInput = document.querySelector(".show");
projectInput.addEventListener("click",()=>{
const form = document.querySelector(".form");
- console.log(form.getAttributeNode("hidden"));
- form.removeAttribute("hidden");
+ Display.toggleShow(form);
});
-const project = document.getElementById("addP");
+const add = document.getElementById("addP");
-project.addEventListener("click", () =>{
+add.addEventListener("click", () =>{
const projectName = document.querySelector(".nameP");
- console.log(projectName.value);
const newProject = Project();
- newProject.addName(projectName.value);
-
+ newProject.addName(projectName.value);
});
+const Display = (() =>{
+ const toggleShow = (name) => {
+ if (name.style.display === "block") {
+ name.style.display = "none";
+ }
+ else {
+ name.style.display = "block";
+ }
+ }
+ const appendList = (node, array) => {
+ array.forEach(element => {
+ let child = node.appendChild(element);
+ return child;
+ });
+ }
+ const delNode = (node)=> {
+ console.log("Remove!");
+
+ node.remove();
+ }
+
+ return {toggleShow, appendList, delNode};
+})();
+
+const Storage = (() =>{
+ const setItems = (name) => {
+
+ }
+ const removeItems = () =>{
+
+ }
+ const clearStorage = () =>{
+
+ }
+
+ return {setItems, removeItems, clearStorage};
+})();
+
const Project = (name) =>{
const getName = () => name;
- //let listName = [];
const addName = (name) => {
- let projectList = document.querySelector(".projectList");
- let project = document.createElement("li");
- let btn = document.createElement("button");
- btn.innerText = `${name}`;
- project.appendChild(btn);
- projectList.appendChild(project);
- }
+ const projectList = document.querySelector(".projectList");
+ const project = document.createElement("li");
+ const link = document.createElement("a");
+ link.setAttribute("href", "project.html");
+ link.innerText = `${name}`;
+
+ const btnDel = document.createElement("button");
+ btnDel.innerText = "-";
+
+ btnDel.addEventListener("click", ()=>{
+ Display.delNode(project);
+ });
+
+ let list = [link, btnDel];
+ Display.appendList(project,list);
+ projectList.appendChild(project);
+
+ console.log(pjctNames);
+ }
return {getName, addName};
}
-const TodoList = () =>{
-
+const TodoList = (name) =>{
+ const getName = () => name;
+ const addList = () =>{
+
+ }
}
const TodoItems = (title, description, dueDate, priority) =>{
const getTitle = () => title;
diff --git a/project.html b/project.html
new file mode 100644
index 0000000..e67a4a5
--- /dev/null
+++ b/project.html
@@ -0,0 +1,13 @@
+
+
+
+
+
+ Project
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/style.css b/style.css
index 8e2e17a..e1b3a0e 100644
--- a/style.css
+++ b/style.css
@@ -3,4 +3,7 @@ ul{
}
li {
list-style: none;
+}
+.form {
+ display: none;
}
\ No newline at end of file