Skip to content

Commit d8f5322

Browse files
authored
Merge pull request #766 from aneeshd27/ToDoList-aneeshd27
Added ToDoList Application in aneeshd27 folder in ToDoList project Folder
2 parents 18432be + ede7f38 commit d8f5322

File tree

5 files changed

+149
-0
lines changed

5 files changed

+149
-0
lines changed

ToDoList/aneeshd27/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
##ToDoList App
2+
3+
A simple to-do list app that implements sticky notes can be a valuable and practical project for a variety of reasons. Below is a detailed description of why such a project is necessary and the benefits it offers:
4+
5+
#Organization and Task Management: In today's busy world, people have numerous tasks and responsibilities to manage, both personally and professionally. A to-do list app provides an organized and efficient way to keep track of these tasks. Sticky notes mimic the physical experience of jotting down tasks on pieces of paper and sticking them to a surface, which can be intuitive and user-friendly.
6+
7+
#Visual Reminders: Sticky notes are inherently visual and attention-grabbing. They stand out on a digital interface, ensuring that tasks and notes are not easily overlooked. This visual aspect aids users in quickly identifying important tasks, deadlines, or notes.
8+
9+
#Flexibility and Creativity: Sticky notes can be moved, resized, and customized with different colors, fonts, and styles. This flexibility allows users to visually organize their tasks and notes in a way that suits their preferences and needs. This creative freedom enhances the user experience and engagement.
10+
11+
#Accessibility: A digital to-do list with sticky notes can be accessed from various devices and platforms, such as desktops, laptops, smartphones, and tablets. This accessibility ensures that users can manage their tasks and notes wherever they are, whether at home, work, or on the go.
12+
13+
#Efficient Editing and Updating: Unlike traditional paper sticky notes, digital sticky notes are easily editable. Users can add, edit, or delete tasks and notes with ease. This makes it practical for users to adapt to changing priorities and deadlines.

ToDoList/aneeshd27/ToDoList.png

30.1 KB
Loading

ToDoList/aneeshd27/index.html

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width,initial-scale=1.0">
6+
<meta http-equip="X-UA-Compatible" content="IE=edge">
7+
<title>My Notes App</title>
8+
<link rel="stylesheet" href="style.css">
9+
<link href="https://fonts.googleapis.com/css2?family=Reenie+Beanie&display=swap" rel="stylesheet">
10+
11+
<script src="script.js" defer></script>
12+
</head>
13+
<body>
14+
<div id="app">
15+
<!--<textarea id="note" class="note">Some sample text</textarea>-->
16+
17+
<button class="add-note" type="button">+</button>
18+
</div>
19+
</body>
20+
</html>

ToDoList/aneeshd27/script.js

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
const notesContainer=document.getElementById("app");
2+
const addNoteButton=notesContainer.querySelector(".add-note");
3+
4+
getNotes().forEach((note)=>{
5+
const noteElement=createNotes(note.id,note.content);
6+
notesContainer.insertBefore(noteElement,addNoteButton);
7+
})
8+
9+
addNoteButton.addEventListener("click",()=>addNote());
10+
11+
function getNotes()//This function is to get notes when needed or when web page is refreshed
12+
{
13+
return JSON.parse(localStorage.getItem("stickynotes-notes")||"[]");
14+
}
15+
function saveNotes(notes)//This function is to save all the notes written and should appear on screen when web page is refreshed
16+
{
17+
localStorage.setItem("stickynotes-notes",JSON.stringify(notes));
18+
}
19+
function createNotes(id,content){
20+
const element=document.createElement("textarea");
21+
element.classList.add("note");
22+
element.value=content;
23+
element.placeholder="Empty Sticky Note";
24+
const currentTime = new Date();
25+
const formattedTime = currentTime.toLocaleString();
26+
27+
// Add the creation time to the note's content
28+
element.value = `${formattedTime}\n${content}`;
29+
30+
31+
32+
33+
element.addEventListener("change",()=>{
34+
updateNote(id,element.value);
35+
});
36+
element.addEventListener("dblclick",()=>{
37+
const doDelete=confirm("Are you sure you want to delete the Sticky note??");
38+
39+
if(doDelete){
40+
deleteNote(id,element);
41+
}
42+
});
43+
44+
45+
return element;
46+
}
47+
function addNote()
48+
{
49+
const existingNotes=getNotes();
50+
const noteObject={
51+
id:Math.floor(Math.random()*10000),
52+
content:""
53+
};
54+
55+
const noteElement=createNotes(noteObject.id,noteObject.content);
56+
notesContainer.insertBefore(noteElement,addNoteButton);
57+
existingNotes.push(noteObject);
58+
saveNotes(existingNotes);
59+
}
60+
function updateNote(id,newContent){
61+
const notes=getNotes();
62+
const targetNote=notes.filter((note)=>note.id==id)[0];
63+
targetNote.content=newContent;
64+
saveNotes(notes);
65+
}
66+
function deleteNote(id,element){
67+
const notes=getNotes().filter((note)=>note.id!=id);
68+
69+
saveNotes(notes);
70+
notesContainer.removeChild(element);
71+
}

ToDoList/aneeshd27/style.css

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
body{
2+
margin: 0;
3+
padding: auto;
4+
background: #56e2db;
5+
}
6+
#app{
7+
display: grid;
8+
grid-template-columns:repeat(auto-fill,200px) ;
9+
padding:30px;
10+
gap:30px;
11+
}
12+
.note{
13+
height: 200px;
14+
border-radius: 10px;
15+
background-color: rgb(246, 246, 138);
16+
padding:10px;
17+
box-sizing: border-box;
18+
border:none;
19+
box-shadow: 0 0 10px;
20+
resize: none;
21+
font-size: 18px;
22+
font-family:'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
23+
}
24+
.note:hover{
25+
cursor: pointer;
26+
transform: scale(1.1,1.1);
27+
rotate: -5deg;
28+
background: rgb(243, 243, 152);
29+
}
30+
.add-note{
31+
height: 200px;
32+
border: none;
33+
outline: none;
34+
border-radius:10px;
35+
font-size: 100px;
36+
box-shadow: 0 0 10px;
37+
transition-duration: 0.1s;
38+
background-color: rgba(0,0,0,0.2);
39+
color: rgba(0,0,0,0.6);
40+
cursor: pointer;
41+
}
42+
.add-note:hover{
43+
background-color: rgba(0,0,0,0.3);
44+
font-size: 120px;
45+
}

0 commit comments

Comments
 (0)