Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1주차] 고윤정 미션 제출합니다. #6

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"trailingComma": "es5",
"tabWidth": 2,
"semi": true,
"singleQuote": true
}
28 changes: 27 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,33 @@
</head>

<body>
<div class="container"></div>
<div class="container">
<section>
<span class="title">To Do List</span>
<form onsubmit="return false">
<input type="text" id="todo-input" placeholder="할 일을 입력하세요" />
<button id="add-button">+</button>
</form>
</section>

<div class="division-line"></div>
Copy link
Member

@corinthionia corinthionia Aug 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

굿굿!


<section class="todo-box">
<span class="todo-list-title">📝 TO DO (0)</span>
<div class="todo-div">
<ul id="todo-list"></ul>
</div>
</section>

<div class="division-line"></div>

<section class="done-box">
<span class="done-list-title">✔️ DONE (0)</span>
<div class="done-div">
<ul id="done-list"></ul>
</div>
</section>
</div>
</body>
<script src="script.js"></script>
</html>
58 changes: 57 additions & 1 deletion script.js
Original file line number Diff line number Diff line change
@@ -1 +1,57 @@
// 다들 화이팅!! ٩( *˙0˙*)۶
// 다들 화이팅!! ٩( *˙0˙*)۶
const todoInput = document.querySelector('#todo-input'); //입력창
const addBtn = document.querySelector('#add-button'); //+ 버튼
const todoList = document.querySelector('#todo-list'); //TO DO
const doneList = document.querySelector('#done-list'); //DONE
const todoTitle = document.querySelector('.todo-box .todo-list-title'); // TO DO 제목
const doneTitle = document.querySelector('.done-box .done-list-title'); // DONE 제목

addBtn.addEventListener('click', () => {
//+ 버튼으로 추가
if (todoInput.value !== '') addToDo();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오호 공백 입력 방지 구현해 주셨네요 👍🏻

});

function addToDo() {
let todoContents = todoInput.value;

const li = document.createElement('li');
const span = document.createElement('span');
const btn = document.createElement('button');

li.appendChild(span); //appendChild() : 선택한 요소 안에 자식요소를 추가
li.appendChild(btn);

span.textContent = todoContents; //textContent : 노드 내의 모든 텍스트 추출
btn.textContent = '✖️';

todoList.appendChild(li);

todoInput.value = '';

updateCount();

//완료
span.addEventListener('click', () => {
li.classList.toggle('complete');
if (li.classList.contains('complete')) {
doneList.appendChild(li);
} else {
todoList.appendChild(li);
}
Comment on lines +35 to +40
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

완전 깔끔하네요 👍🏻👍🏻

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

toggle메서드를 이용해서 요소를 숨기거나 보이게 하는 방법도 매우 좋은 것 같네요! 적용해봐야겠어요 ~

updateCount();
});

//삭제
btn.addEventListener('click', () => {
li.remove();
updateCount();
});
}

function updateCount() {
const todoCount = todoList.children.length;
const doneCount = doneList.children.length;

todoTitle.textContent = `📝 TO DO (${todoCount})`;
doneTitle.textContent = `✔️ DONE (${doneCount})`;
}
134 changes: 133 additions & 1 deletion style.css
Original file line number Diff line number Diff line change
@@ -1 +1,133 @@
/* 자유롭게 디자인 해 주세요! */
/* 자유롭게 디자인 해 주세요! */
@font-face {
font-family: 'LINESeedKR-Th';
src: url('https://fastly.jsdelivr.net/gh/projectnoonnu/[email protected]/LINESeedKR-Th.woff2')
format('woff2');
Comment on lines +3 to +5
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

저도 폰트 적용해야하는데 어떤식으로 적용할지 잘 몰랐던 것 같아요! 다음에 저도 이런식으로 적용해야겠어요!

font-weight: 100;
font-style: normal;
}

@font-face {
font-family: 'LINESeedKR-Rg';
src: url('https://fastly.jsdelivr.net/gh/projectnoonnu/[email protected]/LINESeedKR-Rg.woff2')
format('woff2');
font-weight: 400;
font-style: normal;
}

@font-face {
font-family: 'LINESeedKR-Bd';
src: url('https://fastly.jsdelivr.net/gh/projectnoonnu/[email protected]/LINESeedKR-Bd.woff2')
format('woff2');
font-weight: 700;
font-style: normal;
}

body {
margin: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-image: linear-gradient(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

그라데이션 오묘하니 예쁘네요 ✨🩵

to right,
rgb(176, 196, 222),
rgb(230, 239, 250)
);
}

.container {
width: 360px;
height: 500px;
border-radius: 20px;
padding: 30px 24px 24px 24px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.25);
background-color: white;
}

span.title {
font-family: 'LINESeedKR-Bd';
font-size: 24px;
color: rgb(59, 59, 59);
}

span.todo-list-title,
span.done-list-title {
font-family: 'LINESeedKR-Bd';
color: rgb(59, 59, 59);
}

.division-line {
border-top: 1px solid rgb(222, 222, 222);
}

.todo-box {
margin-top: 15px;
}

.done-box {
margin-top: 15px;
}

.todo-div {
height: 140px;
font-family: 'LINESeedKR-Rg';
}

.done-div {
height: 140px;
}

input {
width: 310px;
height: 40px;
border-radius: 30px;
border-style: solid;
border-width: 1.2px;
border-color: rgb(222, 222, 222);
font-size: 12px;
padding-left: 12px;
margin-top: 15px;
margin-bottom: 15px;
}

input:focus {
outline: none;
border-color: lightsteelblue;
transition: 0.2s;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

해당 css 속성은 저도 몰랐던 부분이네요! 윤정님 코드 보면서 하나 더 알아갑니다!

}

button {
border: none;
width: 25px;
height: 40px;
font-size: 20px;
background-color: white;
cursor: pointer;
}

button:hover {
color: lightsteelblue;
transition: 0.2s;
}
Comment on lines +109 to +112
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오호 lightsteelblue 이 색상 예쁘네요


ul li {
cursor: pointer;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏻👍🏻

}

#todo-list button {
width: 34px;
height: 20px;
font-size: 14px;
}

#done-list button {
width: 34px;
height: 20px;
font-size: 14px;
}

#done-list li.complete {
text-decoration: line-through;
Copy link

@jissssu jissssu Aug 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

텍스트에 장식 효과를 적용하는 속성을 적용해봐야겠어요!!

color: rgb(222, 222, 222);
}