Skip to content

Commit 9d57a97

Browse files
authored
Merge pull request #20 from codeit9-temporary/feature/Header
Feat: 헤더 구현 및 버튼 수정
2 parents 292a07e + ea95d74 commit 9d57a97

File tree

6 files changed

+84
-5
lines changed

6 files changed

+84
-5
lines changed

components/Button.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,10 @@ const Button = ({
2626
return (
2727
<button
2828
style={{
29-
width,
30-
height,
3129
borderRadius: radius,
3230
background: backgroundStyle,
33-
fontSize: size,
3431
}}
35-
className="flex justify-center items-center text-white font-[600] whitespace-nowrap hover:opacity-90"
32+
className={`flex justify-center ${width} ${height} ${size} items-center text-white font-[600] whitespace-nowrap hover:opacity-90`}
3633
{...props}
3734
>
3835
{children}

components/HeaderMenu.tsx

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import Image from "next/image";
2+
import Profile from "@/public/icons/profile.png";
3+
import Star from "@/public/icons/star.png";
4+
import Link from "next/link";
5+
import Button from "./Button";
6+
import { useRouter } from "next/router";
7+
8+
const HeaderMenu = () => {
9+
const isLoggedIn = false;
10+
const router = useRouter();
11+
12+
return (
13+
<>
14+
{!isLoggedIn ? (
15+
<Button
16+
onClick={() => {
17+
router.push("/login");
18+
}}
19+
width="w-[80px] md:w-[128px]"
20+
height="h-[37px] md:h-[53px]"
21+
size="text-[14px] md:text-[18px]"
22+
type="button"
23+
>
24+
로그인
25+
</Button>
26+
) : (
27+
<div className="flex items-center gap-[24px]">
28+
<Link
29+
href={"/favorite"}
30+
className="flex items-center gap-[6px] bg-gray200 border border-purple100 rounded-[4px] py-[10px] px-[12px] text-[12px] leading-[14.32px] md:text-[14px] md:leading-[16.71px] font-normal"
31+
>
32+
<Image
33+
src={Star}
34+
width={14}
35+
height={17}
36+
alt=""
37+
className="align-top"
38+
/>
39+
즐겨찾기
40+
</Link>
41+
<div className="flex items-center gap-[6px] text-[14px] leading-[16.71px] font-normal">
42+
<Image src={Profile} width={28} height={28} alt="프로필" />
43+
{/* 임시 유저 네임 */}
44+
<span className="hidden md:block">전상민</span>
45+
</div>
46+
</div>
47+
)}
48+
</>
49+
);
50+
};
51+
52+
export default HeaderMenu;

components/Layout/Header.tsx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import Logo from "@/public/icons/logo.svg";
2+
import Image from "next/image";
3+
import Link from "next/link";
4+
import HeaderMenu from "../HeaderMenu";
5+
6+
const Header = () => {
7+
return (
8+
<div>
9+
<div className="bg-gray100 py-[13px] px-[32px] md:py-[33px] md:px-[200px]">
10+
<div className="flex justify-between items-center max-w-[1520px]">
11+
<Link
12+
href={"/"}
13+
className="w-[88.67px] h-[16px] md:w-[133px] md:h-[24px]"
14+
>
15+
<Image src={Logo} width={133} height={24} alt="로고" />
16+
</Link>
17+
<HeaderMenu />
18+
</div>
19+
</div>
20+
</div>
21+
);
22+
};
23+
24+
export default Header;

pages/_app.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1+
import Header from "@/components/Layout/Header";
12
import "@/styles/globals.css";
23
import type { AppProps } from "next/app";
34

45
export default function App({ Component, pageProps }: AppProps) {
5-
return <Component {...pageProps} />;
6+
return (
7+
<>
8+
<Header />
9+
<Component {...pageProps} />
10+
</>
11+
);
612
}

public/icons/profile.png

1.21 KB
Loading

public/icons/star.png

1.47 KB
Loading

0 commit comments

Comments
 (0)