-
Notifications
You must be signed in to change notification settings - Fork 10
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
[2주차] 권가은 미션 제출합니다. #5
base: master
Are you sure you want to change the base?
Changes from 14 commits
4fa8ae8
ed43b42
01a1ec0
1e44146
9053055
58cf314
783d304
1ec3e71
f49c786
bd47a49
1f543b4
af7d1c4
6684f9e
ffc4293
95d20a2
0bcf943
7cff06c
c36bc00
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"trailingComma": "es5", | ||
"tabWidth": 2, | ||
"semi": true, | ||
"singleQuote": true | ||
} |
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,42 +2,19 @@ | |
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" /> | ||
<link rel="icon" href="%PUBLIC_URL%/favicon.png" /> | ||
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. 파비콘을 쓸 때는 png를 넣는것보다 확장자 변경 사이트에서 ico 확장자로 변경해서 넣는게 좋다고합니다!! 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. 오 ico 확장자를 사용해서 여러개 사이즈를 정해두면 해상도 문제 없이 사용할 수 있겠네요! 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. 우와웅 저도 이건 처음 알았어요!! 좋은 정보 감사합니다💪🏻 |
||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<meta name="theme-color" content="#000000" /> | ||
<meta | ||
name="description" | ||
content="Web site created using create-react-app" | ||
/> | ||
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" /> | ||
<!-- | ||
manifest.json provides metadata used when your web app is installed on a | ||
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/ | ||
--> | ||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" /> | ||
<!-- | ||
Notice the use of %PUBLIC_URL% in the tags above. | ||
It will be replaced with the URL of the `public` folder during the build. | ||
Only files inside the `public` folder can be referenced from the HTML. | ||
|
||
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will | ||
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`. | ||
--> | ||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" /> | ||
<title>React App</title> | ||
</head> | ||
<body> | ||
<noscript>You need to enable JavaScript to run this app.</noscript> | ||
<div id="root"></div> | ||
<!-- | ||
This HTML file is a template. | ||
If you open it directly in the browser, you will see an empty page. | ||
|
||
You can add webfonts, meta tags, or analytics to this file. | ||
The build step will place the bundled scripts into the <body> tag. | ||
|
||
To begin the development, run `npm start` or `yarn start`. | ||
To create a production bundle, use `npm run build` or `yarn build`. | ||
--> | ||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
import styled from 'styled-components'; | ||
import TodoList from './pages/TodoList'; | ||
|
||
function App() { | ||
return ( | ||
<div> | ||
<h1>17기 프론트 화이팅~ 우하하</h1> | ||
</div> | ||
); | ||
return <TodoList />; | ||
} | ||
|
||
export default App; | ||
export default App; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
import PropTypes from 'prop-types'; | ||
import styled from 'styled-components'; | ||
import { TODOKEY } from '../constants/TODOKEY'; | ||
|
||
const ListContainer = ({ | ||
title, | ||
todoList, | ||
setTodoList, | ||
isDone, | ||
setIsVisibleModal, // 컴포넌트 재사용성이 낮아지는 것 같은데.. 우짜지 | ||
setSelectedTodo, // 컴포넌트 재사용성이 낮아지는 것 같은데.. 우짜지 | ||
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. 재사용성이 낮아진다는것...이 뭔지 저도 잘 모르겠어서 이번주 스터디까지 한번 공부해보고 얘기 해보면 좋을 것 같습니다...ㅎㅎ 댓글로 다른분들이 알려주시면 공부 해가도록 할게요 😄 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. 좋은 방법인진 모르겠지만...
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 toggleIsDone = (e) => { | ||
const tempList = [...todoList]; | ||
tempList.forEach((todo) => { | ||
if (todo.time === e.target.parentElement.id) { | ||
todo.isDone = !todo.isDone; | ||
} | ||
}); | ||
setTodoList(tempList); | ||
|
||
localStorage.setItem(TODOKEY, JSON.stringify(tempList)); | ||
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. 옹... TODOKEY로 localStorage에 넣어주는 방법 되게 좋은 것 같아요..! 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. string value는 최대한 변수로 만들어두고 사용하는 게 오류 사전 방지, 유지보수 측면에서 좋은 것 같아 이렇게 사용하고 있습니다! ㅎㅎ 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. 저도 string으로 사용했었는데 변수로 만들어 두는 것이 더 좋겠네요!! 이렇게 또 배워갑니다ㅠㅠ👏🏻👏🏻👏🏻 |
||
}; | ||
|
||
const handleBtnClick = (e) => { | ||
setSelectedTodo(e.target.parentElement); | ||
setIsVisibleModal(true); | ||
}; | ||
|
||
return ( | ||
<Wrapper> | ||
<Title>{title}</Title> | ||
<Lists> | ||
{todoList | ||
.filter((todo) => todo.isDone === isDone) | ||
.map((todo) => { | ||
return ( | ||
<SingleList id={todo.time} key={todo.time}> | ||
<span onClick={toggleIsDone}>{todo.text}</span> | ||
<button onClick={handleBtnClick}>🗑</button> | ||
</SingleList> | ||
); | ||
})} | ||
</Lists> | ||
</Wrapper> | ||
); | ||
}; | ||
|
||
ListContainer.propTypes = { | ||
title: PropTypes.string, | ||
todoList: PropTypes.array, | ||
setTodoList: PropTypes.func, | ||
isDone: PropTypes.bool, | ||
setIsVisibleModal: PropTypes.func, | ||
setSelectedTodo: PropTypes.func, | ||
}; | ||
Comment on lines
+49
to
+56
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. propTypes를 쓰는 건 처음 봤네요. typesciprt에서만 사용하는 줄 알았는데 js에서도 사용할 수 있다는걸 알아갑니다! 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. TS를 사용하다가 이번 과제를 하며 JS로 하려니 역체감을 느꼈어요.. 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 Wrapper = styled.div` | ||
height: 33%; | ||
display: flex; | ||
flex-direction: column; | ||
`; | ||
|
||
const Title = styled.span` | ||
user-select: none; | ||
`; | ||
|
||
const Lists = styled.div` | ||
padding: 0.6rem; | ||
overflow: auto; | ||
`; | ||
|
||
const SingleList = styled.div` | ||
width: 100%; | ||
padding: 0.1rem 0; | ||
display: flex; | ||
|
||
&:hover { | ||
border-radius: 0.3rem; | ||
background-color: rgb(239, 239, 248); | ||
} | ||
|
||
span { | ||
&:hover { | ||
cursor: pointer; | ||
} | ||
} | ||
|
||
button { | ||
margin: 0 0 0 auto; | ||
background-color: transparent; | ||
border: none; | ||
|
||
&:hover { | ||
cursor: pointer; | ||
} | ||
} | ||
`; | ||
|
||
export default ListContainer; |
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. key를 따로 관리하는 방식 좋네요 🥰 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
const TODOKEY = 'todo'; | ||
export { TODOKEY }; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
@font-face { | ||
font-family: 'Pretendard-Regular'; | ||
src: url('https://cdn.jsdelivr.net/gh/Project-Noonnu/[email protected]/Pretendard-Regular.woff') | ||
format('woff'); | ||
} | ||
|
||
body { | ||
width: 100vw; | ||
height: 100vh; | ||
margin: 0; | ||
background-color: lavender; | ||
|
||
font-family: 'Pretendard-Regular'; | ||
font-weight: 400; | ||
font-style: normal; | ||
font-size: 1rem; | ||
} | ||
Comment on lines
+7
to
+17
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. 가은님은 css 단위를 항상 잘 쓰시는 것 같아요!! vw부터 vh, rem 등등.. 저는 px, % 등의 익숙한 단위들만 사용하다 보니 종종 불편할 때가 있더라구요ㅠㅠ 가은님처럼 상황에 맞는 적절한 단위를 사용하는 것이 더 효율적일 것 같네요!!!👏🏻👏🏻 |
||
|
||
#root { | ||
width: 100%; | ||
height: 100%; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import ReactDOM from 'react-dom/client'; | ||
import App from './App'; | ||
|
||
ReactDOM.render( | ||
import './index.css'; | ||
|
||
ReactDOM.createRoot(document.getElementById('root')).render( | ||
<React.StrictMode> | ||
<App /> | ||
</React.StrictMode>, | ||
document.getElementById('root') | ||
); | ||
</React.StrictMode> | ||
); |
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.
약속의 파비콘ㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋ
이분꺼 업데이트된 (님들이) 만들어 쓰는 개발진스입니당
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.
ㅋㅋㅋㅋㅋㅋ 파비콘 보자마자 리뷰하러 왔는데 역씨... 😸