Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions components/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,10 @@ const Button = ({
return (
<button
style={{
width,
height,
borderRadius: radius,
background: backgroundStyle,
fontSize: size,
}}
className="flex justify-center items-center text-white font-[600] whitespace-nowrap hover:opacity-90"
className={`flex justify-center ${width} ${height} ${size} items-center text-white font-[600] whitespace-nowrap hover:opacity-90`}
{...props}
>
{children}
Expand Down
37 changes: 37 additions & 0 deletions components/HeaderMenu.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import Image from "next/image";
import Profile from "@/public/icons/profile.png"
import Star from "@/public/icons/star.png"
import Link from "next/link";
import Button from "./Button";
import { useRouter } from "next/router";

const HeaderMenu = () => {
const isLoggedIn = false;
const router = useRouter()

const handleClick = () => {
router.push('/login')
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

바로 onClick에서 콜백함수로 구현하면 깔끔합니다!

return (
<>
{!isLoggedIn ? (
<Button onClick={handleClick} width="w-[80px] md:w-[128px]" height="h-[37px] md:h-[53px]" size="text-[14px] md:text-[18px]" type="button">로그인</Button>
) : (
<div className="flex items-center gap-[24px]">
<Link href={'/favorite'} 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">
<Image src={Star} width={14} height={17} alt="" className="align-top"/>즐겨찾기
</Link>
<div className="flex items-center gap-[6px] text-[14px] leading-[16.71px] font-normal">
<Image src={Profile} width={28} height={28} alt="프로필" />
{/* 임시 유저 네임 */}
<span className="hidden md:block">전상민</span>
</div>
</div>
)}
</>
);
}

export default HeaderMenu;

22 changes: 22 additions & 0 deletions components/Layout/Header.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import Logo from "@/public/icons/logo.svg";
import Image from "next/image";
import Link from "next/link";
import HeaderMenu from "../HeaderMenu";

const Header = () => {

return (
<div>
<div className="bg-gray100 py-[13px] px-[32px] md:py-[33px] md:px-[200px]">
<div className="flex justify-between items-center max-w-[1520px]">
<Link href={"/"} className="w-[88.67px] h-[16px] md:w-[133px] md:h-[24px]">
<Image src={Logo} width={133} height={24} alt="로고" />
</Link>
<HeaderMenu />
</div>
</div>
</div>
);
};

export default Header;
8 changes: 7 additions & 1 deletion pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import Header from "@/components/Layout/Header";
import "@/styles/globals.css";
import type { AppProps } from "next/app";

export default function App({ Component, pageProps }: AppProps) {
return <Component {...pageProps} />;
return (
<>
<Header />
<Component {...pageProps} />
</>
);
}
Binary file added public/icons/profile.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 public/icons/star.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.