Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,25 @@
font-weight: normal;
font-style: normal;
}
/* 색상 변수 (코드리뷰 반영) */
:root{
--card-color: #ECECEC;
--bg-color: black;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

색상을 따로 지정해두고 사용하니까 코드가 더 깔끔하네요!

.wrapper{
display: flex;
flex-direction: column;
align-items: center;
}
.header{
display: flex;
height: 150px;
width: 500px;
width: 480px;
align-items: center;
justify-content: center;

}
.logo{
display: flex;
font-size: 2em;
font-weight: 700;
width: 300px;
Expand All @@ -30,14 +37,15 @@
.todoList{
display:flex;
flex-direction: column;
text-align: center;
width: 28em;
}
.todoInput{/*input container*/
display:flex;
height:35px;
padding-bottom: 5px;
}
input{/*input 태그 따로 설정*/
input[type=text]{/*input 태그 따로 설정*/
background-color: var(--bg-color);
color: var(--card-color);
border: solid 2px var(--card-color);
Expand Down Expand Up @@ -66,6 +74,7 @@ input{/*input 태그 따로 설정*/
height: 100px;
margin : 7px 0;
border-radius: 8px;
position: relative;
}
.todoCard.checked{
transition : opacity 0.3s;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

디테일이 좋습니다!!

Expand All @@ -75,11 +84,12 @@ input{/*input 태그 따로 설정*/
opacity: 0.6;
}
.todoElem{
flex:1; /*여백 다 채우게끔*/
margin-left:30px;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

화면 캡처 2023-09-24 145356
todoElem의 가로 폭이 따로 지정되어있지 않아서 위와 같이 나오는 것 같아요!!

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

코드 변경하면서 예외처리를 신경쓰지 못했네요 ㅠㅠ 감사합니다1!

input[type=checkbox]{
margin-left: 20px;
position:absolute; /*checkbox 위치 고정 (코드리뷰 반영)*/
top : 40px;
right : 15px;
}
.todoDelete{
border: none;
Expand Down
70 changes: 35 additions & 35 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,50 +1,50 @@
import "./App.css";
import { useState, useEffect } from "react";
import Cards from "./components/Cards.js";
import Clock from "./components/Clock.js";
function App() {
const [todo, setTodo] = useState(["운동하기", "밥먹기"]);
const [currentTime, setCurrentTime] = useState(new Date());

// 시간 업데이트
const updateClock = () => {
setCurrentTime(new Date());
const [todo, setTodo] = useState([]);
const [newTodo, setNewTodo] = useState("");
//input handler
const handleInputChange = (e) => {
setNewTodo(e.target.value);
};

useEffect(() => {
const timer = setInterval(updateClock, 1000);

return () => {
clearInterval(timer);
};
}, []);

const options = {
weekday: "long",
month: "numeric",
day: "numeric",
hour: "2-digit",
minute: "2-digit",
second: "2-digit",
hour12: false, //오전 오후 나누는거 false 처리
// + 누르거나 enter 둘다 해당함수 호출
const handleAddTodo = () => {
if (newTodo.trim() !== "") {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

trim()으로 처리해주신 디테일 좋아요~~

setTodo([newTodo, ...todo]);
setNewTodo("");
}
};

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

카드 넘어갈 때마다 다른 색으로 바뀌는 거 신박하네요! 색 지정해주는 방식도 나머지 연산자 활용해서 하신 거 정말 좋은 아이디어인 것 같습니다👍

const handleSubmit = (e) => {
e.preventDefault();
handleAddTodo();
};
//string으로 만들어 변수로 변환한다.
const stringTime = currentTime.toLocaleDateString("ko-KR", options);

return (
<>
<div className="header">
<div className="wrapper">
<header className="header">
<div className="logo">TODO-list</div>
<div className="detail">
<div>투두리스트를 작성하고 오늘 하루를 기록해요</div>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

오 / 늘 떨어지는거 약간 킹받습니다... br 해서 띄우면 좋을 것 같습니다...

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

앗 떨어지는 줄 몰랐습니다...감사합니다!

<div id="clock-js">{stringTime}</div>
<Clock />
</div>
</div>
<div className="todoInput">
<input placeholder=" ADD TODO"></input>
<button id="plusButton">+</button>
</div>
<Cards todo={todo}></Cards>
</>
</header>
<form className="todoInput" onSubmit={handleSubmit}>
<input
type="text"
placeholder=" ADD TODO"
value={newTodo}
onChange={handleInputChange}
/>
<button id="plusButton" type="submit">
+
</button>
</form>
<main>
<Cards todo={todo}></Cards>
</main>
</div>
);
}

Expand Down