From 425f1a5483e28c77cca52deb1a38b8161fd0c4b9 Mon Sep 17 00:00:00 2001 From: Geun-Oh Date: Sun, 7 Apr 2024 09:32:31 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=B6=94=EC=95=99=EB=B0=9B=EB=8A=94=20?= =?UTF-8?q?=ED=9A=9F=EC=88=98=EA=B0=80=20=EC=A0=81=ED=9E=88=EB=8F=84?= =?UTF-8?q?=EB=A1=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/OthersDayBook.tsx | 2 +- src/components/OthersDayBookFooter.tsx | 8 ++++++-- src/pages/write/index.tsx | 14 ++++++++++++-- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/components/OthersDayBook.tsx b/src/components/OthersDayBook.tsx index 12167bc..e208584 100644 --- a/src/components/OthersDayBook.tsx +++ b/src/components/OthersDayBook.tsx @@ -47,7 +47,7 @@ const OthersWriting = () => { {daybookData && } - + ); }; diff --git a/src/components/OthersDayBookFooter.tsx b/src/components/OthersDayBookFooter.tsx index fb5cf04..35b584a 100644 --- a/src/components/OthersDayBookFooter.tsx +++ b/src/components/OthersDayBookFooter.tsx @@ -2,11 +2,15 @@ import styled from "@emotion/styled"; import { colors } from "@theme"; import { Link } from "react-router-dom"; -const OthersWritingFooter = () => { +interface OthersWritingFooterProps { + id: number; +} + +const OthersWritingFooter = ({ id }: OthersWritingFooterProps) => { return (
- 나도 일지 작성하기 + 나도 일지 작성하기
); diff --git a/src/pages/write/index.tsx b/src/pages/write/index.tsx index 0efbe5d..c2fa926 100644 --- a/src/pages/write/index.tsx +++ b/src/pages/write/index.tsx @@ -30,6 +30,7 @@ function Write() { const { isLoading, step, nextStep, previousStep } = useStep(); const [searchParams] = useSearchParams(); const query = searchParams.get("from"); + const id = searchParams.get("id"); const StepComponent = STEP_COMPONENTS[step]; const { title, description, buttonText } = StepContentMap.get( @@ -49,8 +50,17 @@ function Write() { }; useEffect(() => { - setDaybook(RESET); - }, [setDaybook]); + if (!id) { + setDaybook(RESET); + } else { + setDaybook({ + respectBoardId: Number(id), + content: '', + category: '', + hashtags: [], + }) + } + }, [setDaybook, id]); if (isLoading) return ;