diff --git a/emotiondiary/public/favicon.ico b/emotiondiary/public/favicon.ico
new file mode 100644
index 00000000..6d284ad1
Binary files /dev/null and b/emotiondiary/public/favicon.ico differ
diff --git a/emotiondiary/public/index.html b/emotiondiary/public/index.html
index 08a297e9..721e837e 100644
--- a/emotiondiary/public/index.html
+++ b/emotiondiary/public/index.html
@@ -1,15 +1,13 @@
-
+
+
-
+
- React App
+ 감정 일기장
diff --git a/emotiondiary/src/App.js b/emotiondiary/src/App.js
index 61fe04ae..f42e108d 100644
--- a/emotiondiary/src/App.js
+++ b/emotiondiary/src/App.js
@@ -49,9 +49,11 @@ function App() {
const diaryList = JSON.parse(localData).sort(
(a, b) => parseInt(b.id) - parseInt(a.id)
);
- dataId.current = parseInt(diaryList[0].id) + 1;
- dispatch({ type: "INIT", data: diaryList });
+ if (diaryList.length >= 1) {
+ dataId.current = parseInt(diaryList[0].id) + 1;
+ dispatch({ type: "INIT", data: diaryList });
+ }
}
}, []);
diff --git a/emotiondiary/src/pages/Diary.js b/emotiondiary/src/pages/Diary.js
index ec62a26b..8f8b552d 100644
--- a/emotiondiary/src/pages/Diary.js
+++ b/emotiondiary/src/pages/Diary.js
@@ -13,6 +13,11 @@ const Diary = () => {
const [data, setData] = useState();
+ useEffect(() => {
+ const titleElement = document.getElementsByTagName("title")[0];
+ titleElement.innerHTML = `감정 일기장 - ${id}번 일기`;
+ }, []);
+
useEffect(() => {
if (diaryList.length >= 1) {
const targetDiary = diaryList.find(
diff --git a/emotiondiary/src/pages/Edit.js b/emotiondiary/src/pages/Edit.js
index 5481785c..ee335e8e 100644
--- a/emotiondiary/src/pages/Edit.js
+++ b/emotiondiary/src/pages/Edit.js
@@ -11,6 +11,11 @@ const Edit = () => {
const { id } = useParams();
+ useEffect(() => {
+ const titleElement = document.getElementsByTagName("title")[0];
+ titleElement.innerHTML = `감정 일기장 - ${id}번 일기 수정`;
+ }, []);
+
useEffect(() => {
if (diaryList.length >= 1) {
const targetDiary = diaryList.find(
diff --git a/emotiondiary/src/pages/Home.js b/emotiondiary/src/pages/Home.js
index 4109bfd6..331c45eb 100644
--- a/emotiondiary/src/pages/Home.js
+++ b/emotiondiary/src/pages/Home.js
@@ -12,6 +12,11 @@ const Home = () => {
const headText = `${curDate.getFullYear()}년 ${curDate.getMonth() + 1}월`;
+ useEffect(() => {
+ const titleElement = document.getElementsByTagName("title")[0];
+ titleElement.innerHTML = `감정 일기장`;
+ }, []);
+
useEffect(() => {
if (diaryList.length >= 1) {
const firstDay = new Date(
diff --git a/emotiondiary/src/pages/New.js b/emotiondiary/src/pages/New.js
index 77c9b66e..d621ace3 100644
--- a/emotiondiary/src/pages/New.js
+++ b/emotiondiary/src/pages/New.js
@@ -1,6 +1,11 @@
+import { useEffect } from "react";
import DiaryEditor from "../components/DiaryEditor";
const New = () => {
+ useEffect(() => {
+ const titleElement = document.getElementsByTagName("title")[0];
+ titleElement.innerHTML = `감정 일기장 - 새 일기`;
+ }, []);
return (