Skip to content
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

first #71

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -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 (
<div className="App">
</div>
<div className='App'><TodoList title={'My TODOs'} /></div>
);
}

Expand Down
31 changes: 31 additions & 0 deletions src/components/Todo/Todo.css
Original file line number Diff line number Diff line change
@@ -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;
}
13 changes: 13 additions & 0 deletions src/components/Todo/Todo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React from 'react'
import './Todo.css'
const Todo = props => {
return (
<div className='Todo'>
<div className={`text ${props.done && 'done'}`} onClick={props.clicked}>
{props.title}
</div>
{props.done && <div className='done-mark'>&#x2713;</div>}
</div>
);
}
export default Todo;
16 changes: 16 additions & 0 deletions src/containers/Todo.js/TodoList.css
Original file line number Diff line number Diff line change
@@ -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;
}
25 changes: 25 additions & 0 deletions src/containers/Todo.js/TodoList.js
Original file line number Diff line number Diff line change
@@ -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 ( <Todo key={td.id} title={td.title}
done={td.done}/> );
});
return (
<div className='TodoList'>
<div className='title'>{this.props.title}</div>
<div className='todos'>{todos}</div>
</div>
);
}
}

export default TodoList