From 9564b1adb65043bd7102d3cf38d7c7bc8b28a85c Mon Sep 17 00:00:00 2001 From: dongkyun-dev Date: Sat, 24 Feb 2024 12:34:13 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=ED=97=A4=EB=8D=94=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Layout/components/Header.tsx | 12 +++++------- src/components/Layout/index.tsx | 14 ++------------ 2 files changed, 7 insertions(+), 19 deletions(-) diff --git a/src/components/Layout/components/Header.tsx b/src/components/Layout/components/Header.tsx index 81522c55..2a5de392 100644 --- a/src/components/Layout/components/Header.tsx +++ b/src/components/Layout/components/Header.tsx @@ -1,24 +1,22 @@ import Link from 'next/link'; +import { usePathname } from 'next/navigation'; import Cookies from 'js-cookie'; import Logo from '@assets/images/logo.svg'; import { ROUTES } from '@constants/routes'; -import { type HeaderType } from '@models/layout'; import { STORAGE_KEY } from '@models/storage'; import * as styles from '../style.css'; import LoginButton from './LoginButton'; import UserButton from './UserButton'; -interface HeaderProps { - type: HeaderType; -} - -const Header = ({ type }: HeaderProps) => { +const Header = () => { const refreshToken = Cookies.get(STORAGE_KEY.REFRESH_TOKEN); + const pathname = usePathname(); + const HeaderButtonGroup = () => - type === 'landing' ? : ; + pathname === ROUTES.LANDING ? : ; return (
diff --git a/src/components/Layout/index.tsx b/src/components/Layout/index.tsx index 80e61f4e..480229db 100644 --- a/src/components/Layout/index.tsx +++ b/src/components/Layout/index.tsx @@ -1,8 +1,6 @@ -import { type PropsWithChildren, useEffect, useState } from 'react'; +import { type PropsWithChildren } from 'react'; import { assignInlineVars } from '@vanilla-extract/dynamic'; -import { type HeaderType } from '@models/layout'; -import { STORAGE_KEY } from '@models/storage'; import { COLORS } from '@styles/tokens'; import Footer from './components/Footer'; @@ -21,17 +19,9 @@ const Layout = ({ isFooter = false, backgroundColor = COLORS['Grey/White'], }: PropsWithChildren) => { - const [type, setType] = useState('landing'); - - useEffect(() => { - const accessToken = localStorage?.getItem(STORAGE_KEY.ACCESS_TOKEN); - const headerType = accessToken ? 'normal' : 'landing'; - setType(headerType); - }, []); - return ( <> - {isHeader &&
} + {isHeader &&
}