Skip to content

Commit 0fe6ec2

Browse files
authored
Merge pull request #25 from IT-Cotato/suminn01-week2
백수민 week2
2 parents a2cd741 + f4eae9d commit 0fe6ec2

File tree

15 files changed

+367
-626
lines changed

15 files changed

+367
-626
lines changed

package-lock.json

Lines changed: 193 additions & 422 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"preview": "vite preview"
1111
},
1212
"dependencies": {
13+
"@tailwindcss/vite": "^4.2.2",
1314
"react": "^19.2.4",
1415
"react-dom": "^19.2.4"
1516
},
@@ -23,6 +24,7 @@
2324
"eslint-plugin-react-hooks": "^7.0.1",
2425
"eslint-plugin-react-refresh": "^0.5.2",
2526
"globals": "^17.4.0",
27+
"tailwindcss": "^4.2.2",
2628
"typescript": "~5.9.3",
2729
"typescript-eslint": "^8.56.1",
2830
"vite": "^8.0.0"

src/App.css

Lines changed: 0 additions & 15 deletions
This file was deleted.

src/App.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
import TodoHeader from './components/TodoHeader';
2-
import TodoList from './components/TodoList';
3-
import './App.css'
1+
import TodoHeader from './components/TodoHeader'
2+
import TodoList from './components/TodoList'
43

54
function App() {
6-
75
return (
8-
<div className="todo-wrapper">
9-
<TodoHeader />
10-
<TodoList />
6+
<div className="flex min-h-screen w-full items-start bg-[#F5F5F5]">
7+
<div className="mx-auto flex w-full max-w-[640px] flex-col items-start gap-[22px]">
8+
<TodoHeader />
9+
<TodoList />
10+
</div>
1111
</div>
1212
)
1313
}
1414

15-
export default App
15+
export default App

src/components/TodoCard.tsx

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,30 @@
1-
import "./css/TodoCard.css"
1+
import EmptyCircleIcon from "../icons/EmptyCircleIcon"
2+
import CheckIcon from "../icons/CheckIcon"
23

3-
export default function TodoCard({ todo }: { todo: string }) {
4-
5-
return (
6-
<div className="todo-card">
7-
<p className="todo-card-text">{todo}</p>
4+
function Item({todo, isCompleted }: {todo: string;isCompleted: boolean;}) {
5+
return(
6+
<div>
7+
{isCompleted ? (
8+
<div className= "flex items-center gap-[12px] text-[#1F2937] opacity-50">
9+
<CheckIcon />
10+
<del>{todo}</del>
11+
</div>
12+
) : (
13+
<div className= "flex items-center gap-[12px] text-[#1F2937]">
14+
<EmptyCircleIcon />
15+
<span>{todo}</span>
816
</div>
9-
)
17+
)}
18+
</div>
19+
)
20+
}
21+
22+
export default function TodoCard({todo, isCompleted }: {todo: string;isCompleted: boolean;}) {
23+
return (
24+
<li className="flex w-full items-center gap-[10px] p-4 rounded-[12px] bg-white shadow-sm">
25+
<p className="text-[14px] leading-[21px] text-[#1F2937]">
26+
<Item todo={todo} isCompleted={isCompleted} />
27+
</p>
28+
</li>
29+
)
1030
}

src/components/TodoHeader.tsx

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1-
import "./css/TodoHeader.css";
2-
31
export default function TodoHeader() {
4-
const emoji = "✅";
5-
const title = "오늘의 할 일";
6-
7-
return (
8-
<div className="todo-header-wrapper">
9-
<div className="todo-header-row">
10-
<span className="todo-header-text">{emoji}</span>
11-
<span className="todo-header-text">{title}</span>
12-
</div>
2+
const emoji = "✅";
3+
const title = "오늘의 할 일";
4+
5+
return (
6+
<div className="flex flex-col items-start gap-[10px] self-stretch py-[10px] mt-[80px]">
7+
<div className="flex h-[36px] items-center gap-[8px] self-stretch">
8+
<span className="text-[24px] font-bold leading-[36px] text-[#1F2937]">
9+
{emoji}
10+
</span>
11+
<span className="text-[24px] font-bold leading-[36px] text-[#1F2937]">
12+
{title}
13+
</span>
1314
</div>
14-
);
15-
}
15+
</div>
16+
);
17+
}

src/components/TodoList.tsx

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
11
import TodoCard from "./TodoCard";
2-
import "./css/TodoList.css"
2+
import { todoData } from "../data/TodoData";
33

44
export default function TodoList() {
5+
const todoItems = todoData.map( item =>
6+
<TodoCard key={item.id} todo = {item.todo} isCompleted = {item.isCompleted} />
7+
);
8+
59
return (
6-
<div className="todo-list">
7-
<TodoCard todo="리액트 공식문서 읽기" />
8-
<TodoCard todo="알고리즘 문제 풀기" />
9-
<TodoCard todo="운동 30분 하기" />
10-
<TodoCard todo="프로젝트 회의 준비" />
11-
</div>
10+
<ul className="flex flex-col items-start gap-[16px] self-stretch">
11+
{todoData.length === 0 ? (
12+
<li className="mx-auto flex w-full max-w-[640px] h-[233px] flex-col items-center justify-center gap-[12px] rounded-[12px] bg-white shadow-sm">
13+
<span className="text-[48px] leading-[72px] text-center">📋</span>
14+
<p className="text-[14px] text-[#6B7280]">아직 할 일이 없어요</p>
15+
</li>
16+
) : (
17+
todoItems
18+
)}
19+
</ul>
1220
)
1321
}

src/components/css/TodoCard.css

Lines changed: 0 additions & 19 deletions
This file was deleted.

src/components/css/TodoHeader.css

Lines changed: 0 additions & 26 deletions
This file was deleted.

src/components/css/TodoList.css

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)