From 6f54c6e1da469a68c9df0d033379b81e2a773fe2 Mon Sep 17 00:00:00 2001 From: "Oh, Sukyeong" Date: Sun, 30 Jun 2024 05:39:54 +0900 Subject: [PATCH] =?UTF-8?q?[Feat]=20=EB=82=B4=EA=B0=80=20=EC=93=B4=20?= =?UTF-8?q?=EC=9D=BC=EA=B8=B0=20=ED=8E=98=EC=9D=B4=EC=A7=80=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.tsx | 16 +-- src/assets/svg/Heart.svg | 3 + src/components/Calendar/Calendar/index.tsx | 1 + src/pages/auth/Login.tsx | 4 +- src/pages/auth/Signup.tsx | 6 +- src/pages/diary/Update.tsx | 141 +++++++++++++++++++++ src/pages/mypage/list.tsx | 82 ++++++++++++ 7 files changed, 242 insertions(+), 11 deletions(-) create mode 100644 src/assets/svg/Heart.svg create mode 100644 src/pages/diary/Update.tsx create mode 100644 src/pages/mypage/list.tsx diff --git a/src/App.tsx b/src/App.tsx index 0a38a59..0414c7b 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -85,14 +85,14 @@ const router = createBrowserRouter(routeObjects); const App = () => { const { currentUser } = useAuth(); const location = window.location; - useEffect(() => { - if ( - (!currentUser || !currentUser.senderId) && - !location.pathname.startsWith("/auth") - ) { - location.replace("/auth/login"); - } - }, [currentUser, location]); + // useEffect(() => { + // if ( + // (!currentUser || !currentUser.senderId) && + // !location.pathname.startsWith("/auth") + // ) { + // location.replace("/auth/login"); + // } + // }, [currentUser, location]); return ; }; diff --git a/src/assets/svg/Heart.svg b/src/assets/svg/Heart.svg new file mode 100644 index 0000000..33190de --- /dev/null +++ b/src/assets/svg/Heart.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/components/Calendar/Calendar/index.tsx b/src/components/Calendar/Calendar/index.tsx index 3243ea3..22803c8 100644 --- a/src/components/Calendar/Calendar/index.tsx +++ b/src/components/Calendar/Calendar/index.tsx @@ -4,6 +4,7 @@ import { Dates, YearMonthDate } from "@/types/common"; import * as S from "./Calendar.styled"; import PrevIcon from "@/assets/svg/icon-arrow-left.svg?react"; import NextIcon from "@/assets/svg/icon-arrow-right.svg?react"; +import HeartIcon from "@/assets/svg/Heart.svg"; export interface Props { dates: Dates[]; diff --git a/src/pages/auth/Login.tsx b/src/pages/auth/Login.tsx index 595b778..834702c 100644 --- a/src/pages/auth/Login.tsx +++ b/src/pages/auth/Login.tsx @@ -51,6 +51,7 @@ const Login = () => { onChangeValue={onChangeName} leftIcon={NameIcon} /> +
{ })), }} /> +
{ onChangeValue={onChangeName} leftIcon={NameIcon} /> +
{ })), }} /> +
{ })), }} /> - +
{ + const location = useLocation(); + const navigate = useNavigate(); + + const [writeState, setWriteState] = useState<"create" | "update">("create"); + const [title, setTitle] = useState(""); + const [content, setContent] = useState(""); + const [sing, setSing] = useState(""); + const [date, setDate] = useState(""); + + const handleEditButton = () => { + mutate({ + title: "", + content: "", + sing: "", + date: "", + }); + }; + + const handleCancelButton = () => { + navigate(-1); + }; + + const onChangeTitle = (e: ChangeEvent) => { + setTitle(e.target.value); + }; + const onChangeContent = (e: ChangeEvent) => { + setContent(e.target.value); + }; + + const onChangeSing = (e: ChangeEvent) => { + setSing(e.target.value); + }; + const onChangeDate = (e: ChangeEvent) => { + setDate(e.target.value); + }; + + useEffect(() => { + if (location && location.state?.update) { + setWriteState("update"); + // todo : 다이어리 글 상태관리 + } else { + setWriteState("create"); + } + }, [location]); + + return ( + <> + + 일기 {writeState === "create" ? "작성" : "수정"} + +
+