From 0c226004842d86bf45dac2f50b1abbacf7b3c44c Mon Sep 17 00:00:00 2001
From: heewon lee <84234411+hiwon-lee@users.noreply.github.com>
Date: Mon, 16 Sep 2024 17:18:34 +0900
Subject: [PATCH 01/29] =?UTF-8?q?style=20:=20=EC=8A=A4=ED=83=80=EC=9D=BC?=
=?UTF-8?q?=20=EC=B4=88=EA=B8=B0=ED=99=94?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/reset.css | 129 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 129 insertions(+)
create mode 100644 public/reset.css
diff --git a/public/reset.css b/public/reset.css
new file mode 100644
index 0000000..a3f7681
--- /dev/null
+++ b/public/reset.css
@@ -0,0 +1,129 @@
+/* http://meyerweb.com/eric/tools/css/reset/
+ v2.0 | 20110126
+ License: none (public domain)
+*/
+
+html,
+body,
+div,
+span,
+applet,
+object,
+iframe,
+h1,
+h2,
+h3,
+h4,
+h5,
+h6,
+p,
+blockquote,
+pre,
+a,
+abbr,
+acronym,
+address,
+big,
+cite,
+code,
+del,
+dfn,
+em,
+img,
+ins,
+kbd,
+q,
+s,
+samp,
+small,
+strike,
+strong,
+sub,
+sup,
+tt,
+var,
+b,
+u,
+i,
+center,
+dl,
+dt,
+dd,
+ol,
+ul,
+li,
+fieldset,
+form,
+label,
+legend,
+table,
+caption,
+tbody,
+tfoot,
+thead,
+tr,
+th,
+td,
+article,
+aside,
+canvas,
+details,
+embed,
+figure,
+figcaption,
+footer,
+header,
+hgroup,
+menu,
+nav,
+output,
+ruby,
+section,
+summary,
+time,
+mark,
+audio,
+video {
+ margin: 0;
+ padding: 0;
+ border: 0;
+ font-size: 100%;
+ font: inherit;
+ vertical-align: baseline;
+}
+/* HTML5 display-role reset for older browsers */
+article,
+aside,
+details,
+figcaption,
+figure,
+footer,
+header,
+hgroup,
+menu,
+nav,
+section {
+ display: block;
+}
+body {
+ line-height: 1;
+}
+ol,
+ul {
+ list-style: none;
+}
+blockquote,
+q {
+ quotes: none;
+}
+blockquote:before,
+blockquote:after,
+q:before,
+q:after {
+ content: '';
+ content: none;
+}
+table {
+ border-collapse: collapse;
+ border-spacing: 0;
+}
From f085121b260c904d47a76cac3920c2750acf49a8 Mon Sep 17 00:00:00 2001
From: heewon lee <84234411+hiwon-lee@users.noreply.github.com>
Date: Mon, 16 Sep 2024 17:19:03 +0900
Subject: [PATCH 02/29] =?UTF-8?q?feat=20:=20=EC=8B=9C=EA=B3=84=20=EC=BB=B4?=
=?UTF-8?q?=ED=8D=BC=EB=84=8C=ED=8A=B8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components/Clock.js | 12 ++++++++++++
1 file changed, 12 insertions(+)
create mode 100644 src/components/Clock.js
diff --git a/src/components/Clock.js b/src/components/Clock.js
new file mode 100644
index 0000000..c4fc2ef
--- /dev/null
+++ b/src/components/Clock.js
@@ -0,0 +1,12 @@
+import { useState, useEffect } from 'react';
+
+export default function Clock() {
+ const [time, setTime] = useState(() => new Date());
+ useEffect(() => {
+ const id = setInterval(() => {
+ setTime(new Date());
+ }, 1000);
+ return () => clearInterval(id);
+ }, []);
+ return
{time.toLocaleTimeString()}
;
+}
From 788e4ddc1fe7f2bf77b9e317784444d3ad4a4cc6 Mon Sep 17 00:00:00 2001
From: heewon lee <84234411+hiwon-lee@users.noreply.github.com>
Date: Tue, 17 Sep 2024 11:57:21 +0900
Subject: [PATCH 03/29] =?UTF-8?q?feat=20:=20todo=20=EC=83=9D=EC=84=B1,=20?=
=?UTF-8?q?=EC=82=AD=EC=A0=9C=20=EA=B8=B0=EB=8A=A5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components/todo/Todo.js | 21 ++++++++++++++++++
src/components/todo/TodoForm.js | 38 +++++++++++++++++++++++++++++++++
src/components/todo/TodoItem.js | 20 +++++++++++++++++
src/components/todo/TodoList.js | 26 ++++++++++++++++++++++
src/hooks/useLocalStorage.js | 29 +++++++++++++++++++++++++
5 files changed, 134 insertions(+)
create mode 100644 src/components/todo/Todo.js
create mode 100644 src/components/todo/TodoForm.js
create mode 100644 src/components/todo/TodoItem.js
create mode 100644 src/components/todo/TodoList.js
create mode 100644 src/hooks/useLocalStorage.js
diff --git a/src/components/todo/Todo.js b/src/components/todo/Todo.js
new file mode 100644
index 0000000..43e59b8
--- /dev/null
+++ b/src/components/todo/Todo.js
@@ -0,0 +1,21 @@
+import { useLocalStorage } from '../../hooks/useLocalStorage';
+import { useEffect } from 'react';
+import TodoForm from './TodoForm';
+import TodoList from './TodoList';
+
+export default function Todo() {
+ const [todos, setTodos] = useLocalStorage('todos', []);
+
+ useEffect(() => {
+ console.log(todos);
+ }, [todos]);
+ return (
+
+
+
+
+ );
+}
diff --git a/src/components/todo/TodoForm.js b/src/components/todo/TodoForm.js
new file mode 100644
index 0000000..a4915ac
--- /dev/null
+++ b/src/components/todo/TodoForm.js
@@ -0,0 +1,38 @@
+import { Button } from '../Button';
+import { useState } from 'react';
+
+export default function TodoForm({ setTodos }) {
+ const [inputValue, setInputValue] = useState('');
+
+ const handleSubmit = (e) => {
+ e.preventDefault(); // form 제출 시 페이지 리로드 방지
+ console.log(inputValue);
+ if (inputValue.trim()) {
+ setTodos((prevTodos) => [
+ ...prevTodos,
+ {
+ id: Date.now(), // 유니크한 ID 생성
+ value: inputValue,
+ completed: false,
+ },
+ ]);
+ setInputValue(''); // 입력 필드 초기화
+ }
+ };
+
+ return (
+
+ );
+}
diff --git a/src/components/todo/TodoItem.js b/src/components/todo/TodoItem.js
new file mode 100644
index 0000000..588fbdd
--- /dev/null
+++ b/src/components/todo/TodoItem.js
@@ -0,0 +1,20 @@
+import { Button } from '../Button';
+
+export function TodoItem({ id, value, isComplete = false, onEdit, onDelete }) {
+ return (
+
+ {isComplete ? end : todo}
+ {value}
+
+
+
+ );
+}
diff --git a/src/components/todo/TodoList.js b/src/components/todo/TodoList.js
new file mode 100644
index 0000000..c60b69c
--- /dev/null
+++ b/src/components/todo/TodoList.js
@@ -0,0 +1,26 @@
+import { TodoItem } from './TodoItem';
+
+export default function TodoList({ todos, setTodos }) {
+ // 투두 수정
+ const handleEdit = (id) => {
+ console.log(`Edit todo with id: ${id}`);
+ };
+
+ // 투두 삭제
+ const handleDelete = (id) => {
+ setTodos(todos.filter((todo) => todo.id !== id));
+ };
+ return (
+
+
+ {todos.map((todo) => (
+ handleEdit(todo.id)}
+ onDelete={() => handleDelete(todo.id)}
+ />
+ ))}
+
+
+ );
+}
diff --git a/src/hooks/useLocalStorage.js b/src/hooks/useLocalStorage.js
new file mode 100644
index 0000000..8b2f8bc
--- /dev/null
+++ b/src/hooks/useLocalStorage.js
@@ -0,0 +1,29 @@
+import { useState } from 'react';
+
+// localStorage 관리하는 커스텀 훅
+export function useLocalStorage(key, initialValue) {
+ // localStorage에서 값을 가져오거나 초기 값을 설정
+ const [storedValue, setStoredValue] = useState(() => {
+ try {
+ const item = window.localStorage.getItem(key);
+ return item ? JSON.parse(item) : initialValue;
+ } catch (error) {
+ console.error('Error reading from localStorage', error);
+ return initialValue;
+ }
+ });
+
+ // localStorage에 값을 설정하는 함수
+ const setValue = (value) => {
+ try {
+ const valueToStore =
+ value instanceof Function ? value(storedValue) : value;
+ setStoredValue(valueToStore);
+ window.localStorage.setItem(key, JSON.stringify(valueToStore));
+ } catch (error) {
+ console.error('Error setting localStorage', error);
+ }
+ };
+
+ return [storedValue, setValue];
+}
From e3bb0f27586e3dbbeaab2952870fc6d6ef47444d Mon Sep 17 00:00:00 2001
From: heewon lee <84234411+hiwon-lee@users.noreply.github.com>
Date: Wed, 18 Sep 2024 23:10:11 +0900
Subject: [PATCH 04/29] =?UTF-8?q?style=20:=20=EB=94=94=EC=9E=90=EC=9D=B8?=
=?UTF-8?q?=20=EB=B0=98=EC=98=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/index.html | 34 +++++++++++++++++++++++++++++-----
public/reset.css | 5 +++++
src/App.css | 47 +++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 81 insertions(+), 5 deletions(-)
create mode 100644 src/App.css
diff --git a/public/index.html b/public/index.html
index aa069f2..6d54e15 100644
--- a/public/index.html
+++ b/public/index.html
@@ -2,19 +2,43 @@
-
-
-
+
+
+
+
-
+
+
+
-
+