Skip to content

Commit

Permalink
feat: 질문하기 버튼 포지션 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
anveloper committed Apr 8, 2024
1 parent 437ed78 commit 0eb6524
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/entities/question-button/ui/question-button.ui.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useNavigate } from "react-router-dom";
import { useLocation, useNavigate } from "react-router-dom";
import styled from "styled-components";

const Wrap = styled.div`
Expand All @@ -23,10 +23,8 @@ const Button = styled.button`
`;

export const QuestionButton = () => {
const location = useLocation();
const isWritePage = location.pathname === "/question/write";
const navigator = useNavigate();
return (
<Wrap>
<Button onClick={() => navigator("/question/write")}>질문하기</Button>
</Wrap>
);
return <Wrap> {!isWritePage && <Button onClick={() => navigator("/question/write")}>질문하기</Button>}</Wrap>;
};

0 comments on commit 0eb6524

Please sign in to comment.