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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
node_modules
node_modules
439 changes: 406 additions & 33 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-scripts": "5.0.1",
"styled-components": "^6.0.8",
"styled-reset": "^4.5.1",
"web-vitals": "^2.1.4"
},
"scripts": {
Expand Down
Binary file modified public/favicon.ico
Binary file not shown.
2 changes: 1 addition & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
<title>TODO</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
Expand Down
90 changes: 90 additions & 0 deletions src/App.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
@font-face {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

GlobalStyle 따로 정의하신 만큼 전체 컴포넌트에 중복되는 속성의 경우 GlobalStyle 사용해도 좋을 것 같아요!

font-family: 'GmarketSansMedium';
src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_2001@1.1/GmarketSansMedium.woff') format('woff');
font-weight: normal;
font-style: normal;
}
.header{
display: flex;
height: 150px;
width: 500px;
align-items: center;
justify-content: center;
}
.logo{
font-size: 2em;
font-weight: 700;
width: 300px;
}
.detail{
font-size: 1em;
width: 180px;
}
#clock-js{
padding-top: 5px;
}
.todoList{
display:flex;
flex-direction: column;
width: 28em;
}
.todoInput{/*input container*/
display:flex;
height:35px;
padding-bottom: 5px;
}
input{/*input 태그 따로 설정*/
background-color: black;
color: #ECECEC;
border: solid 2px #ECECEC;
border-radius: 6px;
width: 400px;
}
#plusButton{
background-color: black;
color: #ECECEC;
border: solid 2px #ECECEC;
border-radius: 6px;
width: 35px;
margin-left: 5px;
transition : border 0.3s, color 0.3s;
}
#plusButton:hover{
border : solid 2px #5f5f5f;
color : #5f5f5f;
}
.todoCard{
background-color: #ECECEC;
color : black;
display:flex; /*todoElem 세로축 가운데 정렬*/
align-items:center;
justify-content:space-between;/* item 사이 간격 균일하게 */
height: 100px;
margin : 7px 0;
border-radius: 8px;
}
.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.

디테일이 좋습니다!!

opacity: 0.5;
}
.todoCard.checked:hover{ /*마우스 올렸을 때 살짝 밝게*/
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;
}
.todoDelete{
border: none;
margin-bottom: 80px;
margin-right: 5px;
font-size: 7px;
border-radius: 2px;
transition : background-color 0.3s;
}
.todoDelete:hover{
background-color: #b1b1b1;
}
52 changes: 47 additions & 5 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,51 @@
import "./App.css";
import { useState, useEffect } from "react";
import Cards from "./components/Cards.js";
function App() {
return (
<div>
<h1>18기 프론트 화이팅~ 푸하항ㅋ</h1>
</div>
);
const [todo, setTodo] = useState(["운동하기", "밥먹기"]);
const [currentTime, setCurrentTime] = useState(new Date());

// 시간 업데이트
const updateClock = () => {
setCurrentTime(new Date());
};
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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


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 처리
};
//string으로 만들어 변수로 변환한다.
const stringTime = currentTime.toLocaleDateString("ko-KR", options);

return (
<>
<div 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>
</div>
</div>
<div className="todoInput">
<input placeholder=" ADD TODO"></input>
<button id="plusButton">+</button>
</div>
<Cards todo={todo}></Cards>
</>
);
}

export default App;
16 changes: 16 additions & 0 deletions src/GlobalStyle.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { createGlobalStyle } from "styled-components";
import reset from "styled-reset";

const GlobalStyle = createGlobalStyle`
${reset};
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.

저는 css reset한거 좋은 것 같아요! 저도 다음과제부터 해야겠어요

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

저도 배워갑니다!!! 써봐야겠어요!~!

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

저도 배워갑니다•••

body{
background-color: black;
color : #ECECEC;
font-family: 'GmarketSansMedium';
display: flex;
flex-direction: column;
align-items: center;
}
`;

export default GlobalStyle;
60 changes: 60 additions & 0 deletions src/components/Cards.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import "../App";
function Cards(props) {
return (
<>
{props.todo.map((element, i) => {
return (
<div className="todoList">
<div className="todoCard">
<div className="todoElem">{element}</div>
<div className="todoDelete">X</div>
</div>
</div>
);
})}
</>
);
}

export default Cards;

// .todoList{
// display:flex;
// flex-direction: column;
// width: 450px;
// }
// .todoCard{
// background-color: #ECECEC;
// color : black;
// display:flex; /*todoElem 세로축 가운데 정렬*/
// align-items:center;
// justify-content:space-between;/* item 사이 간격 균일하게 */
// height: 100px;
// margin : 7px 0;
// border-radius: 8px;
// }
// .todoCard.checked{
// transition : opacity 0.3s;
// opacity: 0.5;
// }
// .todoCard.checked:hover{ /*마우스 올렸을 때 살짝 밝게*/
// opacity: 0.6;
// }
// .todoElem{
// flex:1; /*여백 다 채우게끔*/
// margin-left:30px;
// }
// input[type=checkbox]{
// margin-left: 20px;
// }
// .todoDelete{
// border: none;
// margin-bottom: 80px;
// margin-right: 5px;
// font-size: 7px;
// border-radius: 2px;
// transition : background-color 0.3s;
// }
// .todoDelete:hover{
// background-color: #b1b1b1;
// }
13 changes: 7 additions & 6 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';

import React from "react";
import ReactDOM from "react-dom";
import App from "./App";
import GlobalStyle from "./GlobalStyle";
ReactDOM.render(
<React.StrictMode>
<GlobalStyle />
<App />
</React.StrictMode>,
document.getElementById('root')
);
document.getElementById("root")
);