diff --git a/img/logo.png b/img/logo.png new file mode 100644 index 0000000..f9424b3 Binary files /dev/null and b/img/logo.png differ diff --git a/img/tick.png b/img/tick.png new file mode 100644 index 0000000..93fb436 Binary files /dev/null and b/img/tick.png differ diff --git a/img/untick.png b/img/untick.png new file mode 100644 index 0000000..8ad0706 Binary files /dev/null and b/img/untick.png differ diff --git a/index.html b/index.html new file mode 100644 index 0000000..72a8643 --- /dev/null +++ b/index.html @@ -0,0 +1,29 @@ + + + + + + To-Do List App + + + +
+
+

To-Do List

+
+ + +
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/script.js b/script.js new file mode 100644 index 0000000..379e764 --- /dev/null +++ b/script.js @@ -0,0 +1,38 @@ +const inputBox = document.getElementById("input-box"); +const listContainer = document.getElementById("list-container"); + +function addTask(){ + if(inputBox.value === ''){ + alert("you must write something"); + } + else{ + let li = document.createElement("li"); + li.innerHTML = inputBox.value; + listContainer.appendChild(li); + let span = document.createElement("span"); + span.innerHTML = "\u00d7"; + li.appendChild(span); + } + inputBox.value = ''; + saveData(); +} + +listContainer.addEventListener("click", function(e){ + if(e.target.tagName == "LI"){ + e.target.classList.toggle("checked"); + saveData(); + } + else if(e.target.tagName === "SPAN"){ + e.target.parentElement.remove(); + saveData(); + } +}, false); + +function saveData(){ + localStorage.setItem("data", listContainer.innerHTML); +} + +function showTask(){ + listContainer.innerHTML = localStorage.getItem("data") +} +showTask(); \ No newline at end of file diff --git a/style.css b/style.css new file mode 100644 index 0000000..2708c97 --- /dev/null +++ b/style.css @@ -0,0 +1,111 @@ +*{ + margin: 0; + padding: 0; + font-family: 'poppins', sans-serif; + box-sizing: border-box; +} + +.container{ + width: 100%; + min-height: 100vh; + background: linear-gradient(135deg, #153677, #4e085f); + padding: 10px; +} + +.todo-app{ + width: 100%; + max-width: 540px; + background: #fff; + margin: 100px auto 20px; + padding: 40px 30px 70px; + border-radius: 20px; +} + +.todo-app h2{ + color: #002765; + display: flex; + align-items: center; + margin-bottom: 20px; +} + +.todo-app h2 img{ + width: 50px; + margin-left: 15px; +} + +.row{ + display: flex; + align-items: center; + justify-content: space-between; + background: #edeef0; + border-radius: 30px; + padding-left: 20px; + margin-bottom: 25px; +} + +input{ + flex: 1; + border: none; + outline: none; + background: transparent; + padding: 10px; +} + +button{ + border: none; + outline: none; + padding: 16px 50px; + background: #ff5945; + color:#fff; + font-size:16px; + border-radius: 40px; + cursor: pointer; +} + +ul li{ + list-style: none; + font-size: 17px; + padding: 12px 8px 12px 50px; + user-select: none; + cursor: pointer; + position: relative; +} + +ul li::before{ + content: ' '; + position: absolute; + height: 28px; + width: 28px; + border-radius: 50%; + background-image: url(img/untick.png); + background-size: cover; + background-position: center; + top: 12px; + left: 8px; +} + +ul li.checked{ + color: #555; + text-decoration: line-through; +} + +ul li.checked::before{ + background-image: url(img/tick.png); + +} + +ul li span{ + position: absolute; + right: 0; + top: 5px; + width: 40px; + height: 40px; + font-size: 22px; + line-height: 40px; + text-align: center; +} + +ul li span:hover{ + background: #c4c6cb; + border-radius: 20px; +} \ No newline at end of file