-
Notifications
You must be signed in to change notification settings - Fork 10
[2주차] 이규호 미션 제출합니다. #9
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
base: master
Are you sure you want to change the base?
Changes from 1 commit
7b70be2
1b90ebb
2f3f0f5
ca8c2a0
31c0cd6
1761c96
25aa120
474f8ac
30ff7ce
12444f3
a904ba5
040a0f2
a90782a
d5f8656
4b077c1
aefd4f1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,18 +4,25 @@ | |
| font-weight: normal; | ||
| font-style: normal; | ||
| } | ||
| /* 색상 변수 (코드리뷰 반영) */ | ||
| :root{ | ||
| --card-color: #ECECEC; | ||
| --bg-color: black; | ||
| } | ||
| .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; | ||
|
|
@@ -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); | ||
|
|
@@ -66,6 +74,7 @@ input{/*input 태그 따로 설정*/ | |
| height: 100px; | ||
| margin : 7px 0; | ||
| border-radius: 8px; | ||
| position: relative; | ||
| } | ||
| .todoCard.checked{ | ||
| transition : opacity 0.3s; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 디테일이 좋습니다!! |
||
|
|
@@ -75,11 +84,12 @@ input{/*input 태그 따로 설정*/ | |
| opacity: 0.6; | ||
| } | ||
| .todoElem{ | ||
| flex:1; /*여백 다 채우게끔*/ | ||
| margin-left:30px; | ||
| } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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; | ||
|
|
||
| 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() !== "") { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. trim()으로 처리해주신 디테일 좋아요~~ |
||
| setTodo([newTodo, ...todo]); | ||
| setNewTodo(""); | ||
| } | ||
| }; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 오 / 늘 떨어지는거 약간 킹받습니다... br 해서 띄우면 좋을 것 같습니다...
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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> | ||
| ); | ||
| } | ||
|
|
||
|
|
||

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
색상을 따로 지정해두고 사용하니까 코드가 더 깔끔하네요!