Skip to content

Commit

Permalink
레이아웃 추가 수정 (#34)
Browse files Browse the repository at this point in the history
* feat: 필터 카테고리 가운데 정렬

* chore: 배너 이미지 수정

* feat: 질문하기 버튼 포지션 변경
  • Loading branch information
anveloper authored Apr 8, 2024
1 parent c6699c8 commit 6ba3f65
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 16 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>;
};
17 changes: 13 additions & 4 deletions src/shared/banner/banner.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useLocation } from "react-router-dom";
import { styled } from "styled-components";

import bannerImg from "~/shared/icons/main/banner.png";
Expand All @@ -7,17 +8,25 @@ const Wrapper = styled.div`
max-width: 1440px;
margin: auto;
height: 410px;
display: flex;
justify-content: center;
align-items: center;
`;

const Img = styled.img`
width: 100%;
height: 100%;
`;

export const Banner = () => {
const location = useLocation();
const isWritePage = location.pathname.includes("/question");
return (
<Wrapper>
<Img src={bannerImg} alt="banner" />
</Wrapper>
<>
{!isWritePage && (
<Wrapper>
<Img src={bannerImg} alt="banner" />
</Wrapper>
)}
</>
);
};
Binary file modified src/shared/icons/main/banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/shared/icons/main/banner2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 3 additions & 6 deletions src/widgets/top-filter/ui/top.ui.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { useLocation } from "react-router-dom";
import styled from "styled-components";

import { QuestionButton } from "~/entities/question-button";
Expand All @@ -18,15 +17,13 @@ const Wrapper = styled.div`
max-width: 1440px;
}
`;

const Empty = styled.span``;
export const Top = () => {
const location = useLocation();
const isWritePage = location.pathname === "/question/write";

return (
<Wrapper>
<Empty />
<QuestionListFilter />
{!isWritePage && <QuestionButton />}
<QuestionButton />
</Wrapper>
);
};

0 comments on commit 6ba3f65

Please sign in to comment.