From 77faf30a05b4541d5c07a1e8209fa0fabe4549cc Mon Sep 17 00:00:00 2001 From: harvey Date: Fri, 18 Sep 2020 20:56:33 +0900 Subject: [PATCH] first --- src/App.js | 4 ++-- src/components/Todo/Todo.css | 31 +++++++++++++++++++++++++++++ src/components/Todo/Todo.js | 13 ++++++++++++ src/containers/Todo.js/TodoList.css | 16 +++++++++++++++ src/containers/Todo.js/TodoList.js | 25 +++++++++++++++++++++++ 5 files changed, 87 insertions(+), 2 deletions(-) create mode 100644 src/components/Todo/Todo.css create mode 100644 src/components/Todo/Todo.js create mode 100644 src/containers/Todo.js/TodoList.css create mode 100644 src/containers/Todo.js/TodoList.js diff --git a/src/App.js b/src/App.js index e358583..17319af 100644 --- a/src/App.js +++ b/src/App.js @@ -1,11 +1,11 @@ import React from 'react'; import logo from './logo.svg'; import './App.css'; +import TodoList from './containers/TodoList/TodoList'; function App() { return ( -
-
+
); } diff --git a/src/components/Todo/Todo.css b/src/components/Todo/Todo.css new file mode 100644 index 0000000..41754d1 --- /dev/null +++ b/src/components/Todo/Todo.css @@ -0,0 +1,31 @@ +.Todo { + border-top: 1px solid #f1f3f5; + padding: 1rem; + display: flex; + align-items: center; + transition: all 0.15s; + } + + .Todo .text { + flex: 1; + text-align: left; + word-break: break-all; + cursor: pointer; + } + + .Todo .text:hover { + color: orange; + } + + .Todo .done { + text-decoration: line-through; + color: #adb5bd; + } + + .Todo .done-mark { + font-size: 1.5rem; + line-height: 1rem; + margin-left: 1rem; + color: orange; + font-weight: 800; + } \ No newline at end of file diff --git a/src/components/Todo/Todo.js b/src/components/Todo/Todo.js new file mode 100644 index 0000000..f0a8a05 --- /dev/null +++ b/src/components/Todo/Todo.js @@ -0,0 +1,13 @@ +import React from 'react' +import './Todo.css' +const Todo = props => { + return ( +
+
+ {props.title} +
+ {props.done &&
} +
+ ); + } + export default Todo; \ No newline at end of file diff --git a/src/containers/Todo.js/TodoList.css b/src/containers/Todo.js/TodoList.css new file mode 100644 index 0000000..a1bfa68 --- /dev/null +++ b/src/containers/Todo.js/TodoList.css @@ -0,0 +1,16 @@ +.TodoList { + background: white; + width: 512px; + box-shadow: 0 3px 9px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23); /* 그림자 */ + margin: auto; + margin-top: 4rem; + } + + .TodoList .title { + padding: 2rem; + font-size: 2.5rem; + text-align: center; + font-weight: 500; + background: orange; + color: black; + } \ No newline at end of file diff --git a/src/containers/Todo.js/TodoList.js b/src/containers/Todo.js/TodoList.js new file mode 100644 index 0000000..5e11d7e --- /dev/null +++ b/src/containers/Todo.js/TodoList.js @@ -0,0 +1,25 @@ +import React, { Component } from 'react'; +import './TodoList.css' +class TodoList extends Component { + state = { + todos: [ + { id: 1, title: 'SWPP', content: 'take swpp class', done: true}, + { id: 2, title: 'Movie', content: 'watch movie', done: false }, + { id: 3, title: 'Dinner', content: 'eat dinner', done: false }, + ], + } + render() { + const todos = this.state.todos.map((td) => { + return ( ); + }); + return ( +
+
{this.props.title}
+
{todos}
+
+ ); + } +} + +export default TodoList \ No newline at end of file