-
Notifications
You must be signed in to change notification settings - Fork 13
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
[3주차] 유세은 미션 제출합니다. #17
base: master
Are you sure you want to change the base?
Changes from all commits
c373848
a9ae2e3
017d1e3
66eddc7
b93a1a7
4b31b4d
9c7dc48
bffe993
11f9be4
86baa08
1a80341
69e228c
01d0f97
2ac5314
cf4f6da
87c6f95
d2db47d
ccf83f3
e8fa5c5
34f5101
96aadaa
2bc838e
bcf61ef
c919dc0
cae7c49
9e5c1a7
b18eb6f
7edb589
d54b32f
1778e95
661a42f
722a2f8
e505470
8654c3b
056454c
7a3fff3
9c89bdf
08fa742
261dbac
f205724
023c79f
dc76fa8
efc3160
717e487
0a3ffab
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,3 @@ | ||
{ | ||
"typescript.tsdk": "node_modules\\typescript\\lib" | ||
} |
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"root": true, | ||
"parser": "@typescript-eslint/parser", | ||
"plugins": [ | ||
"@typescript-eslint" | ||
], | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/eslint-recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"prettier/react", | ||
"prettier", | ||
"airbnb", | ||
"airbnb/hooks", | ||
"prettier/react", | ||
"plugin:@typescript-eslint/recommended", | ||
"prettier/@typescript-eslint", | ||
"plugin:prettier/recommended" | ||
], | ||
"rules": { | ||
"no-console": 1, | ||
"no-loops/no-loops": 2 | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"trailingComma": "es5", | ||
"tabWidth": 2, | ||
"semi": true, | ||
"parser": "typescript", | ||
"singleQuote": true | ||
} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { useState } from "react"; | ||
import './Design/background'; | ||
import Clock from './clock'; | ||
import Todobox from "./component/ToDo"; | ||
import Donebox from "./component/Done"; | ||
import InputForm from "./component/Inputform"; | ||
import {Container, InputBox} from "./Design/BoxDesign"; | ||
|
||
function App() { | ||
const [toDoList, setToDoList] = useState<string[]>([]); | ||
const [doneToDoList, setDoneToDoList] = useState<string[]>([]); | ||
Comment on lines
+10
to
+11
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. useState 에도 타입설정을 해줘야하는지 지금 알았어요 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. 이상하게 타입을 지정해주지 않으면 제 코드에선 오류가 나더라구요😅아마 저는 props로 직접 전달해서 그런 것 같아요 ! 보통 생략하는 경우도 많더라구요! |
||
|
||
|
||
|
||
return ( | ||
<div> | ||
<Clock/> | ||
<Container> | ||
<h1>❗투두리스트❗</h1> | ||
<InputBox> | ||
|
||
<InputForm | ||
toDoList={toDoList} | ||
setToDoList ={setToDoList}/> | ||
</InputBox> | ||
<hr/> | ||
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. hr태그가 있으면 중간에 선이 생겨 구분이 가능해지더라구요! |
||
|
||
<Todobox | ||
type = "Todo" | ||
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. 텍스트는 중괄호 없이도 prop 전달이 되는군요! |
||
setDoneToDoList ={setDoneToDoList} | ||
ItemList = {toDoList} | ||
setToDoList ={setToDoList}/> | ||
<hr/> | ||
|
||
<Donebox | ||
type = "Done" | ||
setDoneToDoList ={setDoneToDoList} | ||
ItemList = {doneToDoList} | ||
setToDoList ={setToDoList}/> | ||
</Container> | ||
</div> | ||
|
||
); | ||
|
||
} | ||
|
||
export default App; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
//Container 디자인 관리 | ||
|
||
import styled from 'styled-components'; | ||
|
||
|
||
export const Container = styled.div | ||
` | ||
text-align: center; | ||
width: 360px; | ||
height: 600px; | ||
background-color: white; | ||
display: flex; | ||
flex-direction: column; | ||
border-bottom: 1px solid grey; | ||
border-radius: 9px; | ||
` | ||
; | ||
|
||
export const InputBox = styled.header | ||
` | ||
font-family: 'SuncheonB'; | ||
flex: 0.2; | ||
border-bottom: 1px solid grey; | ||
|
||
` | ||
; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
//list 디자인 관리 | ||
import styled from 'styled-components'; | ||
|
||
interface ILIst { | ||
|
||
color ?:string; | ||
decoration ?:string; | ||
|
||
} | ||
Comment on lines
+4
to
+9
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. 저는 이 부분 신경 못 썼는데 styled-components 에도 꼼꼼하게 해주셨네요 |
||
|
||
export const ListTitle = styled.div | ||
`font-size: 20px; | ||
` | ||
; | ||
|
||
export const List = styled.li<ILIst> | ||
` | ||
color: ${(props) => props.color || "black"}; | ||
text-decoration: ${(props) => props.decoration || "none"}; | ||
` | ||
Comment on lines
+4
to
+20
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. styled component에서 interface를 사용하고, 태그 요소에 제네릭 사용하시는게 신기하네요. 심지어 props까지 받아서 사용하시고 styled component 잘쓰시는 것 같아요 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. 이상하게 인터페이스를 만들지 않으면 props가 전달이 안되더라구요 ,,! 그래서 구글링 했더니 styled-component에서 props를 받으려면 인터페이스를 만들어줘야 한다고 합니다(?) 사실 저도 잘 모르겠다는,,,, |
||
|
||
export const Button = styled.span | ||
` | ||
margin:4px; | ||
` | ||
|
||
export const Ul = styled.ul | ||
|
||
` | ||
|
||
margin: 0; | ||
padding: 0; | ||
flex: 0.5; | ||
border-bottom: 1px solid grey; | ||
overflow: auto; | ||
list-style:none; | ||
cursor: pointer; | ||
|
||
` | ||
; | ||
|
||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
export const colors : string[] = [ | ||
"#0fbcf9", | ||
"#00d8d6", | ||
"#05c46b", | ||
"#ffc048", | ||
"#ffdd59" | ||
|
||
]; | ||
|
||
const firstColor = colors[Math.floor(Math.random() * colors.length)]; | ||
const secondColor = colors[Math.floor(Math.random() * colors.length)]; | ||
|
||
document.body.style.background = `linear-gradient(${firstColor}, ${secondColor})`; | ||
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. 다른 컬러들도 추가해보겠습니다 😄 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { createGlobalStyle } from "styled-components"; | ||
|
||
const GlobalStyle = createGlobalStyle` | ||
|
||
@font-face { | ||
font-family: 'SuncheonB'; | ||
src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/[email protected]/SuncheonB.woff') format('woff'); | ||
font-weight: normal; | ||
font-style: normal; | ||
} | ||
|
||
body{ | ||
|
||
font-family: 'SuncheonB'; | ||
font-size: 15px; | ||
display: flex; | ||
width: 100vh; | ||
height: 100vh; | ||
justify-content: center; | ||
align-items: center; | ||
margin: 0 auto; | ||
|
||
|
||
} | ||
|
||
`; | ||
|
||
export default GlobalStyle; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { useEffect ,useState } from "react"; | ||
import styled from "styled-components"; | ||
|
||
function Clock() { | ||
const [time, setTime] = useState<string>(); | ||
|
||
function getTime (){ | ||
const date = new Date(); | ||
|
||
const hours = String(date.getHours()).padStart(2, "0"); | ||
const minutes = String(date.getMinutes()).padStart(2, "0"); | ||
const seconds = String(date.getSeconds()).padStart(2, "0"); | ||
|
||
let nowTime =`${hours}:${minutes}:${seconds}`; | ||
setTime(nowTime); | ||
} | ||
Comment on lines
+3
to
+16
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. getTime을 functional component밖에서 정의하고 nowTime을 리턴하도록 해서 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. 훨씬 코드가 깔끔해질 것 같습니다 감사합니다!! |
||
|
||
useEffect(()=>{ | ||
setInterval(getTime, 1000); | ||
return () => { | ||
setInterval(getTime, 1000) | ||
} | ||
|
||
},[]); | ||
|
||
const Clock = styled.h1 | ||
`text-align: center` | ||
; | ||
Comment on lines
+26
to
+28
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. styled component도 functional component 밖에서 정의하는걸 추천하더라구요~ 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. 앗 놓친 부분~ 감사합니다!! |
||
|
||
|
||
return <Clock>{time}</Clock>; | ||
|
||
}; | ||
|
||
|
||
export default Clock; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import styled, { createGlobalStyle } from "styled-components"; | ||
import { ListTitle, Button, Ul,List} from "../Design/ListDesign"; | ||
import useToDo from "../hooks/useToDo"; | ||
import {ItemList} from "../type/type"; | ||
|
||
/*type DoneProps = { | ||
|
||
type : string; | ||
setDoneToDoList: ()=>void; | ||
doneToDoList : Array<string>; | ||
setToDoList: ()=>void; | ||
} | ||
*/ | ||
|
||
function Done({type,setDoneToDoList ,ItemList ,setToDoList} : ItemList){ | ||
|
||
let list : string[] = ItemList; | ||
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. list를 따로 정의하는 이유가 있는 것 인가요? 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. ItemList를 props로 받아오고 바로 useToDo훅에 그 ItemList를 또 props로 전달하는데 이 과정에서 둘이 이름이 같아서인지(?) 제대로 전달이 안되더라구요 ㅠㅠ 그래서 한번 변수에 저장하고 했더니 전달이 잘 됐습니다! |
||
|
||
const {deleteButton, moveButton} = useToDo({type,setDoneToDoList ,list ,setToDoList}); | ||
return ( | ||
<Ul className = "done-box"> | ||
<ListTitle>👻Done({ItemList.length})</ListTitle> | ||
{ItemList.map((item, id) => ( | ||
<List color="gray" decoration ="line-through" key={id}> | ||
<Button onClick={() => moveButton(item,id)}>📂</Button> | ||
{item} | ||
<Button onClick={() => deleteButton(item,id)}>❌</Button> | ||
</List> | ||
|
||
))} | ||
</Ul> | ||
|
||
); | ||
} | ||
|
||
export default Done; |
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.
에어비앤비 룰 좋아요