Skip to content
This repository was archived by the owner on Sep 19, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
a48b0ac
commit index.js
eun-ko Apr 10, 2020
78602bf
commit todo-input.js
eun-ko Apr 10, 2020
d32f6c6
commit todo-list
eun-ko Apr 10, 2020
c6b4eb0
commit todo-item
eun-ko Apr 10, 2020
4fcb6a2
removed annotation from todo-input
eun-ko Apr 10, 2020
24701f0
modified todo-input into Functionform
eun-ko Apr 11, 2020
da88499
modified todo-item into Functionform
eun-ko Apr 11, 2020
36ca813
modified todo-list into Functionform
eun-ko Apr 11, 2020
6a43e90
modified index into functionform
eun-ko Apr 11, 2020
7214305
remainders
eun-ko Apr 11, 2020
c9275e0
index.js 태그 수정
eun-ko Apr 11, 2020
a9facbb
index.js Contents태그 수정
eun-ko Apr 11, 2020
f3bb657
index.js Space태그 수정
eun-ko Apr 11, 2020
c373a62
index.js useState수정
eun-ko Apr 11, 2020
cbd796a
index.js 이벤트 핸들러 제거
eun-ko Apr 11, 2020
ee2c9a7
handleDelete 수정
eun-ko Apr 11, 2020
642f327
handleAdd 수정
eun-ko Apr 11, 2020
bdcce67
index.js return수정
eun-ko Apr 11, 2020
0a2afa5
todo-input useState 및 핸들러 수정
eun-ko Apr 11, 2020
e296564
todo-input Input 및 Textarea태그 수정
eun-ko Apr 11, 2020
9a75af3
todo-input Label태그 수정
eun-ko Apr 11, 2020
125ec5f
todo-input Row 태그 수정
eun-ko Apr 11, 2020
80fb443
SubmitButton 태그 수정
eun-ko Apr 11, 2020
4010002
todo-input Wrapper 태그 수정
eun-ko Apr 11, 2020
bd4a2d4
todo-input return 수정
eun-ko Apr 11, 2020
bf2bf80
todo-list.js 수정
eun-ko Apr 11, 2020
14e8e62
todo-item.js 수정
eun-ko Apr 11, 2020
56d65b9
태그 안맞는 부분들 수정
eun-ko Apr 11, 2020
bd5bf70
오류...
eun-ko Apr 12, 2020
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: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,5 @@ yarn-error.log*
.env.development.local
.env.test.local
.env.production.local

.now
2 changes: 1 addition & 1 deletion .now/project.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"orgId":"vC0ivr1sq0T0zKJytpWAmdFN","projectId":"QmU68M4LipQZeiFKBEhK7WmUX9o8wjXK3RGeuiZ8PSWDDK"}
{"orgId":"RZuBNQFBfWtPw3WJZD7K3bSt","projectId":"QmeT1xUQTCRFLjVdW4RXLX6vVPW9baLYyyMnnGcDXeTqtp"}
93 changes: 77 additions & 16 deletions components/todo-input.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,81 @@
import React from "react";
import styled from "styled-components";
import React, { useState } from 'react';
import styled from 'styled-components';

export default function TodoInput() {
return (
<Wrapper>
리액트-투두
<br />
시간을 입력하는 칸
<br />
Todo를 입력하는 칸
</Wrapper>
);
export default function TodoInput(props) {
const [newTodo, setNewTodo] = useState({ date: '', todo: '' });
const { onSubmit } = props;

console.log(newTodo);

const handleFormChange = (e) => {
setNewTodo({ ...newTodo, [e.target.name]: e.target.value });
};

return (
<Wrapper>
<Row>
<Label>시간</Label>
<Input
type="number"
name="date"
placeholder="날짜를 입력하세요 (ex.20200404)"
onChange={handleFormChange}
/>
</Row>
<Row>
<Label>TODO</Label>
<TextArea
name="todo"
placeholder="할 일을 입력하세요"
onChange={handleFormChange}
/>
</Row>
<SubmitButton onClick={() => onSubmit(newTodo)}>등록</SubmitButton>
</Wrapper>
);
}

const Wrapper = styled.div`
border: solid 1px;
font-size: 18px;
flex: 1;
const Input = styled.input`
width: 80%;
border: 1px solid rgb(97, 97, 97);
padding: 0.5rem 0.8rem;
`;
const TextArea = styled.textarea`
width: 80%;
height: 30vh;
resize: none;
border: 1px solid rgb(97, 97, 97);
padding: 0.5rem 0.8rem;
`;
const Label = styled.label`
font-size: 1.5rem;
color: white;
margin: 0;
`;
const Row = styled.div`
color: white;
width: 100%;
display: flex;
flex-direction: row;
justify-content: space-between;
margin-bottom: 3rem;
`;
const Wrapper = styled.form`
font-size: 18px;
width: 40%;
display: flex;
flex-direction: column;
align-items: center;
height: 37rem;
border: 1px solid black;
padding: 1rem 2rem;
`;
const SubmitButton = styled.button`
color: white;
background-color: rgb(97, 97, 97);
font-size: 1.5rem;
outline: none;
border: none;
padding: 0.5rem 1rem;
border-radius: 0.3rem;
`;
52 changes: 45 additions & 7 deletions components/todo-item.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,49 @@
import React from "react";
import styled from "styled-components";
import React from 'react';
import styled from 'styled-components';

export default function TodoItem() {
return <Wrapper>Todo</Wrapper>;
export default function TodoItem(props) {
const { todoObj, onDelete } = props;
const { todo, date } = todoObj;
return (
<Wrapper>
<Row>
<P>{todo}</P>
<P>{date}</P>
</Row>
<DeleteButton onClick={onDelete}>??</DeleteButton>
</Wrapper>
);
}

const Row = styled.div`
display: flex;
flex-direction: row;
justify-content: space-between;
`;
const P = styled.p`
font-size: 1.5rem;
color: white;
`;
const DeleteButton = styled.button`
display: block;
color: white;
background-color: rgb(97, 97, 97);
font-size: 1.5rem;
outline: none;
border: none;
border-radius: 0.3rem;
padding: 0.5rem 1rem;
width: fit-content;
margin-left: auto;
`;
const Wrapper = styled.div`
font-size: 18px;
border: solid 1px;
font-size: 18px;
border: solid 1px black;

width: 100%;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: flex-start;
margin-bottom: 3rem;
padding: 1rem 2rem;
`;
37 changes: 24 additions & 13 deletions components/todo-list.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,30 @@
import React from "react";
import styled from "styled-components";
import React from 'react';
import styled from 'styled-components';

import TodoItem from "./todo-item";
import TodoItem from './todo-item';

export default function TodoList() {
return (
<Wrapper>
Todo list가 들어가는 자리입니다!
<TodoItem />
</Wrapper>
);
export default function TodoList(props) {
const { todos, onDelete } = props;

return (
<Wrapper>
{todos
.sort((todo1, todo2) => {
return todo1.date - todo2.date;
})
.map((todoObj, index) => (
<TodoItem
key={JSON.stringify(todoObj)}
{...{ todoObj }}
onDelete={onDelete(index)}
/>
))}
</Wrapper>
);
}

const Wrapper = styled.div`
border: solid 1px;
font-size: 18px;
flex: 1;
width:40%
font-size: 18px;
flex: 1;
`;
100 changes: 50 additions & 50 deletions pages/_app.js
Original file line number Diff line number Diff line change
@@ -1,55 +1,55 @@
import React from "react";
import App from "next/app";
import Head from "next/head";
import React from 'react';
import App from 'next/app';
import Head from 'next/head';

class PickkApp extends App {
render() {
const { Component, pageProps } = this.props;
return (
<>
<Head>
<title>리액트 Todo</title>
</Head>
<Component {...pageProps} />
<style jsx global>{`
html {
margin: 0;
padding: 0;
position: relative;
}
body {
margin: 0;
padding: 0;
font-size: 0.1rem;
overflow-x: hidden;
width: 100%;
}
::-webkit-scrollbar {
display: none;
}
input {
-webkit-appearance: none;
-webkit-border-radius: 0;
}
html,
body,
body > div:nth-child(2) {
height: 100%;
}
*,
::after,
::before {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
html {
font-size: 10px;
}
`}</style>
</>
);
}
render() {
const { Component, pageProps } = this.props;
return (
<>
<Head>
<title>Todo</title>
</Head>
<Component {...pageProps} />
<style jsx global>{`
html {
margin: 0;
padding: 0;
position: relative;
}
body {
margin: 0;
padding: 0;
font-size: 0.1rem;
overflow-x: hidden;
width: 100%;
}
::-webkit-scrollbar {
display: none;
}
input {
-webkit-appearance: none;
-webkit-border-radius: 0;
}
html,
body,
body > div:nth-child(2) {
height: 100%;
}
*,
::after,
::before {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
html {
font-size: 10px;
}
`}</style>
</>
);
}
}

export default PickkApp;
Loading