Skip to content

Commit 425f1a5

Browse files
committed
feat: 추앙받는 횟수가 적히도록
1 parent 67986fe commit 425f1a5

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

src/components/OthersDayBook.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ const OthersWriting = () => {
4747
<Wrapper>
4848
{daybookData && <Card isDetail daybook={daybookData} />}
4949
</Wrapper>
50-
<OthersWritingFooter />
50+
<OthersWritingFooter id={Number(id)} />
5151
</>
5252
);
5353
};

src/components/OthersDayBookFooter.tsx

+6-2
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@ import styled from "@emotion/styled";
22
import { colors } from "@theme";
33
import { Link } from "react-router-dom";
44

5-
const OthersWritingFooter = () => {
5+
interface OthersWritingFooterProps {
6+
id: number;
7+
}
8+
9+
const OthersWritingFooter = ({ id }: OthersWritingFooterProps) => {
610
return (
711
<Footer>
812
<div>
9-
<Link to={"/write"}>나도 일지 작성하기</Link>
13+
<Link to={`/write?id=${id}`}>나도 일지 작성하기</Link>
1014
</div>
1115
</Footer>
1216
);

src/pages/write/index.tsx

+12-2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ function Write() {
3030
const { isLoading, step, nextStep, previousStep } = useStep();
3131
const [searchParams] = useSearchParams();
3232
const query = searchParams.get("from");
33+
const id = searchParams.get("id");
3334

3435
const StepComponent = STEP_COMPONENTS[step];
3536
const { title, description, buttonText } = StepContentMap.get(
@@ -49,8 +50,17 @@ function Write() {
4950
};
5051

5152
useEffect(() => {
52-
setDaybook(RESET);
53-
}, [setDaybook]);
53+
if (!id) {
54+
setDaybook(RESET);
55+
} else {
56+
setDaybook({
57+
respectBoardId: Number(id),
58+
content: '',
59+
category: '',
60+
hashtags: [],
61+
})
62+
}
63+
}, [setDaybook, id]);
5464

5565
if (isLoading) return <LoadingSpinner />;
5666

0 commit comments

Comments
 (0)