Skip to content

Commit

Permalink
deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
Vijaykumar775 committed Dec 21, 2023
1 parent 2f4bf55 commit d3463d3
Show file tree
Hide file tree
Showing 6 changed files with 178 additions and 0 deletions.
Binary file added img/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/tick.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/untick.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 29 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>To-Do List App</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container">
<div class="todo-app">
<h2>To-Do List <img src="/img/logo.png"></h2>
<div class="row">
<input type="text" id="input-box" placeholder="add your text">
<button onclick="addTask()">Add</button>
</div>
<ul id="list-container">
<!-- <li class="checked">Task 1</li>
<li>Task 2</li>
<li>Task 3</li> -->
</ul>
</div>

</div>


<script src="script.js"></script>
</body>
</html>
38 changes: 38 additions & 0 deletions script.js
Original file line number Diff line number Diff line change
@@ -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();
111 changes: 111 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
@@ -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;
}

0 comments on commit d3463d3

Please sign in to comment.