오늘의 감정
+오늘의 일기
+{data.content}
+diff --git a/emotiondiary/src/App.css b/emotiondiary/src/App.css index 0f5ac5c3..18a1b5e9 100644 --- a/emotiondiary/src/App.css +++ b/emotiondiary/src/App.css @@ -300,3 +300,76 @@ header button { background-color: #fd565f; color: white; } + +/* Diary */ + +.DiaryPage { +} + +.DiaryPage section { + width: 100%; + margin-bottom: 100px; + + display: flex; + flex-direction: column; + align-items: center; + text-align: center; +} + +.DiaryPage h4 { + font-size: 22px; + font-weight: bold; +} + +.DiaryPage .diary_img_wrapper { + background-color: #ececec; + width: 250px; + height: 250px; + border-radius: 5px; + display: flex; + flex-direction: column; + align-items: center; + justify-content: space-around; +} + +.DiaryPage .diary_img_wrapper_1 { + background-color: #64c964; +} + +.DiaryPage .diary_img_wrapper_2 { + background-color: #9dd772; +} + +.DiaryPage .diary_img_wrapper_3 { + background-color: #fdce17; +} + +.DiaryPage .diary_img_wrapper_4 { + background-color: #fd8446; +} + +.DiaryPage .diary_img_wrapper_5 { + background-color: #fd565f; +} + +.DiaryPage .emotion_descript { + font-size: 25px; + color: white; +} + +.DiaryPage .diary_content_wrapper { + width: 100%; + background-color: #ececec; + border-radius: 5px; + word-break: keep-all; + overflow-wrap: break-word; +} + +.DiaryPage .diary_content_wrapper p { + padding: 20px; + text-align: left; + font-size: 20px; + font-family: "Yeon Sung"; + font-weight: 400; + line-height: 2.5; +} diff --git a/emotiondiary/src/components/DiaryEditor.js b/emotiondiary/src/components/DiaryEditor.js index e24d21d5..7cda565d 100644 --- a/emotiondiary/src/components/DiaryEditor.js +++ b/emotiondiary/src/components/DiaryEditor.js @@ -6,55 +6,12 @@ import MyButton from "./MyButton"; import EmotionItem from "./EmotionItem"; import { DiaryDispatchContext } from "../App"; +import { getStringDate } from "../util/date"; +import { emotionList } from "../util/emotion"; + const env = process.env; env.PUBLIC_URL = env.PUBLIC_URL || ""; -const emotionList = [ - { - emotion_id: 1, - emotion_img: process.env.PUBLIC_URL + `/assets/emotion1.png`, - emotion_descript: "행복함", - }, - { - emotion_id: 2, - emotion_img: process.env.PUBLIC_URL + `/assets/emotion2.png`, - emotion_descript: "좋음", - }, - { - emotion_id: 3, - emotion_img: process.env.PUBLIC_URL + `/assets/emotion3.png`, - emotion_descript: "그럭저럭", - }, - { - emotion_id: 4, - emotion_img: process.env.PUBLIC_URL + `/assets/emotion4.png`, - emotion_descript: "나쁨", - }, - { - emotion_id: 5, - emotion_img: process.env.PUBLIC_URL + `/assets/emotion5.png`, - emotion_descript: "끔찍함", - }, -]; - -const getStringDate = (date) => { - let year = date.getFullYear(); - - let month = date.getMonth() + 1; - - let day = date.getDate(); - - if (month < 10) { - month = `0${month}`; - } - - if (day < 10) { - day = `0${day}`; - } - - return `${year}-${month}-${day}`; -}; - const DiaryEditor = ({ isEdit, originData }) => { const [content, setContent] = useState(""); const [emotion, setEmotion] = useState(3); diff --git a/emotiondiary/src/pages/Diary.js b/emotiondiary/src/pages/Diary.js index 907f6b27..62fabda4 100644 --- a/emotiondiary/src/pages/Diary.js +++ b/emotiondiary/src/pages/Diary.js @@ -1,15 +1,78 @@ -import { useParams } from "react-router-dom"; +import { useContext, useEffect, useState } from "react"; +import { useNavigate, useParams } from "react-router-dom"; +import { DiaryStateContext } from "../App"; +import MyButton from "../components/MyButton"; +import MyHeader from "../components/MyHeader"; +import { getStringDate } from "../util/date"; +import { emotionList } from "../util/emotion"; const Diary = () => { const { id } = useParams(); - console.log(id); + const diaryList = useContext(DiaryStateContext); + const navigate = useNavigate(); - return ( -
이곳은 일기 상세 페이지 입니다.
-{data.content}
+