Skip to content

Commit

Permalink
Refactor: Login/Join 페이지에서 로고만 보이게 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
jisupark123 committed Dec 21, 2023
1 parent d90ead9 commit aba6b18
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
13 changes: 12 additions & 1 deletion components/layouts/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import { deleteUser } from '@/apis/deleteUser';
import { iconMenuDisabledUrls } from '@/libs/iconMenuDisabledUrls';
import { authToken } from '@/class/authToken';

function Header() {
// onlyLogo: 로고만 보여줄지 (로그인, 회원가입 페이지에서 사용)
function Header({ onlyLogo }: { onlyLogo?: boolean }) {
const router = useRouter();
const queryClient = useQueryClient();
const { user, isError } = useUserQuery();
Expand All @@ -26,6 +27,7 @@ function Header() {

// 아이콘 메뉴 활성화 여부
const isIconMenuAbled = !iconMenuDisabledUrls.includes(router.pathname);

// 로그아웃
function handleLogout() {
// 도메인 연결 전까지는 refreshToken이 작동하지 않으므로 logout 요청 보내지 않고 새로고침만
Expand Down Expand Up @@ -112,6 +114,15 @@ function Header() {
return () => document.body.removeEventListener('click', closeIconMenus);
});

if (onlyLogo)
return (
<nav className='fixed w-full h-78 flex justify-between items-center z-header bg-tertiary px-28 desktop:px-218'>
<Link href={'/'}>
<Image src={'/imgs/logo1.png'} alt='logo' width={63} height={42} priority />
</Link>
</nav>
);

return (
<nav className='fixed w-full h-78 flex justify-between items-center z-header bg-tertiary px-28 desktop:px-218'>
{/* 헤더 왼쪽 부분 */}
Expand Down
6 changes: 5 additions & 1 deletion components/layouts/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,21 @@ import Header from './header';
import HeadMeta, { HeadMetaProps } from './headMeta';
import OnlyUser from './onlyUser';
import OnlyNotUser from './onlyNotUser';
import { useRouter } from 'next/router';

type LayoutProps = {
onlyAccess?: 'user' | 'notUser' | 'all';
children: React.ReactNode;
};

const Layout: React.FC<LayoutProps & HeadMetaProps> = ({ metaDescription, onlyAccess = 'all', children }) => {
const router = useRouter();
// 로그인 페이지인지
const isLoginOrJoinPage = router.pathname == '/login' || router.pathname == '/join';
return (
<>
<HeadMeta {...{ metaDescription }} />
<Header />
<Header onlyLogo={isLoginOrJoinPage} />
<div className='pt-78'>
<div className='h-full'>
{onlyAccess === 'user' && <OnlyUser>{children}</OnlyUser>}
Expand Down

0 comments on commit aba6b18

Please sign in to comment.