Skip to content

Commit

Permalink
update images source
Browse files Browse the repository at this point in the history
  • Loading branch information
GeekyHacks committed Jul 26, 2023
1 parent 6750b6c commit 52e638e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
8 changes: 5 additions & 3 deletions src/modules/addTask.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ export const taskarr = JSON.parse(localStorage.getItem('taskarr')) || [];

export const addTask = (description, index) => {
index = taskarr.length;
const newTask = new TaskObject(description, index);
const newTask = new TaskObject(description, index + 1);
taskarr.push(newTask);
// this will sort out the user input index
const sortedArr = [...taskarr];
sortedArr.sort((a, b) => a.index - b.index);

// const sortedArr = [...taskarr];
// sortedArr.sort((a, b) => a.index - b.index);

// taskarr.sort((a, b) => a.index - b.index);
saveData(taskarr);
return taskarr;
};
Expand Down
13 changes: 10 additions & 3 deletions src/modules/displayList.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,27 @@ export default (task) => {
taskDescription.forEach((task, index) => {
task.addEventListener('click', (event) => {
task.classList.add('edit');
return event.preventDefault();
// if (event === false) {
// taskDescription.parentElement.addEventListener('click', () => task.classList.remove('edit'));
// }
return event.preventDefault(task.classList.remove('edit'));
});

task.addEventListener('change', (event) => {
event.preventDefault();
task.readOnly = false;
task.classList.remove('edit');
RTCRtpReceiver;
// RTCRtpReceiver;

return event.preventDefault();
});
// the trick is with input
task.addEventListener('input', () => {
task.addEventListener('input', (event) => {
event.preventDefault();
taskarr[index].description = task.value;
saveData(taskarr);
});
});

// taskDescription.parentElement.addEventListener('click', () => task.classList.remove('edit'));
};
2 changes: 0 additions & 2 deletions src/styles/sass/main.sass
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ body
white-space: pre-wrap
word-wrap: break-word
padding: 3rem
// height: 100vh
img
transition: all 0.5s
.container
Expand All @@ -23,7 +22,6 @@ img
box-shadow: $box-shadow
padding: 10px
text-align: left
width: 50%
#tasksList
@include columnFlex
gap: .2rem
Expand Down

0 comments on commit 52e638e

Please sign in to comment.