Skip to content

Commit

Permalink
Initial commit on week7 branch
Browse files Browse the repository at this point in the history
  • Loading branch information
yujeongit committed Jan 7, 2024
0 parents commit 1e61fed
Show file tree
Hide file tree
Showing 155 changed files with 156,765 additions and 0 deletions.
24 changes: 24 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Main 페이지</title>
<link rel="stylesheet" href="styles.css">
</head>

<body>
<div class="main-container">
<h1>Notes App</h1>
<div id="noteList">
<ul id="notesList"></ul>
</div>
<div id="noteBoxes"></div>
<button id="createNoteBtn">Create Note</button>


</div>

<script src="main.js"></script>
</body>
</html>
1 change: 1 addition & 0 deletions leeYuJeong
Submodule leeYuJeong added at 2fdeb2
53 changes: 53 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// main.js
window.onload = function () {
displayNoteBoxes();
document.getElementById('createNoteBtn').addEventListener('click', function () {
window.location.href = 'http://127.0.0.1:5500/write.html';
});
};


function displayNoteBoxes() {
var noteBoxesContainer = document.getElementById('noteBoxes');
noteBoxesContainer.innerHTML = '';

var notes = JSON.parse(localStorage.getItem('notes')) || [];

notes.forEach(function (note) {
var noteBox = document.createElement('div');
noteBox.className = 'note-box';

var titleElement = document.createElement('h2');
titleElement.textContent = note.title;

var contentElement = document.createElement('p');
contentElement.textContent = note.content;

noteBox.appendChild(titleElement);
noteBox.appendChild(contentElement);

noteBoxesContainer.appendChild(noteBox);
});
}

function doneClicked() {
var title = document.getElementById('titleInput').value;
var content = document.getElementById('contentInput').value;

if (title.trim() !== '' && content.trim() !== '') {
var notes = JSON.parse(localStorage.getItem('notes')) || [];
var note = {
title: title,
content: content
};
notes.push(note);
localStorage.setItem('notes', JSON.stringify(notes));

document.getElementById('titleInput').value = '';
document.getElementById('contentInput').value = '';

displayNoteBoxes();
} else {
alert('Please enter both title and content.');
}
}
16 changes: 16 additions & 0 deletions node_modules/.bin/loose-envify

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions node_modules/.bin/loose-envify.cmd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions node_modules/.bin/loose-envify.ps1

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

92 changes: 92 additions & 0 deletions node_modules/.package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 1e61fed

Please sign in to comment.