Skip to content

Commit

Permalink
Added new styles to li elements
Browse files Browse the repository at this point in the history
  • Loading branch information
robert-ds committed May 4, 2024
1 parent 476b6a2 commit b8da5c8
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 15 deletions.
26 changes: 21 additions & 5 deletions assets/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@
font-weight: 400;
line-height: 1.5;
color: #333;
margin: 1rem;
}

h1 {
text-align: center;
font-size: 3rem;
color: darkorange;
color: darkgreen;
}

.container {
margin: 0 auto;
height: 90vh;
width: 90%;
height: 90%;
}

input, button {
Expand All @@ -31,6 +31,11 @@
border: none;
border-radius: 4px;
outline: none;
margin: 5px 5px;
}

input {
border: 1px solid darkgreen;
}

button {
Expand All @@ -42,19 +47,30 @@
ul {
list-style: none;
padding: 0;
margin-top: 15px;
}

li {
background-color: #fff;
background-color: lightgreen;
display: flex;
align-items: center;
justify-content: flex-start;
justify-content: space-between;
margin-bottom: 10px;
padding: 10px;
border-radius: 4px;
}

li span {
color: darkgreen;
font-weight: bold;
margin: 8px;
}

.completed {
text-decoration: line-through;
}

.delete-button {
float: right;
}

11 changes: 6 additions & 5 deletions assets/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ function createTaskElement(task) {
taskCheckBox.type = 'checkbox';
taskCheckBox.checked = task.isCompleted;


taskCheckBox.addEventListener('change', () => {
task.isCompleted = taskCheckbox.checked;
task.isCompleted = taskCheckBox.checked;
taskText.classList.toggle("completed", task.isCompleted);
saveTasksToLocalStorage(app.tasks);
});
Expand Down Expand Up @@ -80,17 +81,17 @@ function saveTasksToLocalStorage(tasks) {

window.onload = () => {
const savedTasks = JSON.parse(localStorage.getItem('tasks') || []);
app.tasks = savedTasks.map((task => {
app.tasks = savedTasks.map((task) => {
return createTask(task.title, task.isCompleted);
}));
});

app.tasks.forEach((task) => {
return addTaskToList(task, app.tasksList);
})
});
};

addTaskButton.addEventListener('click', () => {
alert("save");
// alert("save");
addTask(app);
});

Expand Down
8 changes: 3 additions & 5 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,10 @@ <h1>Todo List</h1>

<div class="container">

<input type="text" name="" id="new-task-input" placeholder="Write task">
<button id="add-task-button">Add task</button>
<input type="text" id="new-task-input" placeholder="Write task">
<button id="add-task-button">Add</button>

<ul id="task-list">

</ul>
<ul id="task-list"></ul>

</div>

Expand Down

0 comments on commit b8da5c8

Please sign in to comment.