Skip to content

Commit

Permalink
feat: 투표 도메인에 layout를 통한 헤더 적용
Browse files Browse the repository at this point in the history
  • Loading branch information
Leejha committed Oct 14, 2023
1 parent e2000e9 commit 26598ec
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 4 deletions.
3 changes: 1 addition & 2 deletions apps/jurumarble/src/app/vote/[id]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"use client";

import Header from "components/Header";
import styled, { css } from "styled-components";
import VoteWriterBox from "./components/VoteWriterBox";
import { ExImg1 } from "public/images";
Expand Down Expand Up @@ -29,6 +28,7 @@ import VoteSmallSelectFilter from "./components/VoteSmallSelectFilter";

function Detail() {
const params = useParams();

const [filter, setFilter] = useState({
age: "",
mbti: "",
Expand Down Expand Up @@ -103,7 +103,6 @@ function Detail() {
} = originalStatistics;
return (
<Container>
<Header />
<VoteWriterBox
writer={{
nickName: postedUserNickname,
Expand Down
41 changes: 41 additions & 0 deletions apps/jurumarble/src/app/vote/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
"use client";

import Header from "components/Header";
import Path from "lib/Path";
import { usePathname, useRouter } from "next/navigation";
import { PropsWithChildren } from "react";
import { Button } from "components/button";
import VoteHeader from "components/VoteHeader";
import styled, { css } from "styled-components";
import { SvgIcPrevious } from "src/assets/icons/components";

export default function Layout({ children }: PropsWithChildren) {
const pathname = usePathname();
const router = useRouter();

return (
<>
{pathname === Path.VOTE_HOME ? (
<Header />
) : (
<VoteHeader
leftButton={
<PreviousButton onClick={() => router.back()}>
<SvgIcPrevious width={24} height={24} />
</PreviousButton>
}
>
상세페이지
</VoteHeader>
)}
{children}
</>
);
}

const PreviousButton = styled(Button)`
${({ theme }) => css`
margin-left: 20px;
background-color: ${theme.colors.white};
`}
`;
2 changes: 0 additions & 2 deletions apps/jurumarble/src/app/vote/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import BottomBar from "components/BottomBar";
import { Button } from "components/button";
import Header from "components/Header";
import { media } from "lib/styles";
import { useRouter, useSearchParams } from "next/navigation";
import SvgIcDetail from "src/assets/icons/components/IcDetail";
Expand Down Expand Up @@ -92,7 +91,6 @@ function VoteHomePage() {
<ScrollImage onClick={onScrollBottom}>
<Image src={ImgScroll} alt="스크롤" width={60} height={64} />
</ScrollImage>
<Header />
<AskVoteBox>
<AskVoteText>
여행에서 즐길 우리술은
Expand Down

0 comments on commit 26598ec

Please sign in to comment.