Skip to content

Commit

Permalink
feat: 추앙받는 횟수가 적히도록
Browse files Browse the repository at this point in the history
  • Loading branch information
Geun-Oh committed Apr 7, 2024
1 parent 67986fe commit 425f1a5
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/components/OthersDayBook.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const OthersWriting = () => {
<Wrapper>
{daybookData && <Card isDetail daybook={daybookData} />}
</Wrapper>
<OthersWritingFooter />
<OthersWritingFooter id={Number(id)} />
</>
);
};
Expand Down
8 changes: 6 additions & 2 deletions src/components/OthersDayBookFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<Footer>
<div>
<Link to={"/write"}>나도 일지 작성하기</Link>
<Link to={`/write?id=${id}`}>나도 일지 작성하기</Link>
</div>
</Footer>
);
Expand Down
14 changes: 12 additions & 2 deletions src/pages/write/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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 <LoadingSpinner />;

Expand Down

0 comments on commit 425f1a5

Please sign in to comment.