Skip to content

Commit

Permalink
[Fix/BAR-266] 헤더 버튼 노출 이슈 해결 (#88)
Browse files Browse the repository at this point in the history
fix: 헤더 수정
  • Loading branch information
miro-ring authored Feb 24, 2024
1 parent 8e35ae7 commit 2c5ec7e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 19 deletions.
12 changes: 5 additions & 7 deletions src/components/Layout/components/Header.tsx
Original file line number Diff line number Diff line change
@@ -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' ? <LoginButton /> : <UserButton />;
pathname === ROUTES.LANDING ? <LoginButton /> : <UserButton />;

return (
<header className={styles.header}>
Expand Down
14 changes: 2 additions & 12 deletions src/components/Layout/index.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -21,17 +19,9 @@ const Layout = ({
isFooter = false,
backgroundColor = COLORS['Grey/White'],
}: PropsWithChildren<LayoutProps>) => {
const [type, setType] = useState<HeaderType>('landing');

useEffect(() => {
const accessToken = localStorage?.getItem(STORAGE_KEY.ACCESS_TOKEN);
const headerType = accessToken ? 'normal' : 'landing';
setType(headerType);
}, []);

return (
<>
{isHeader && <Header type={type} />}
{isHeader && <Header />}
<main
className={styles.mainWrapper}
style={assignInlineVars({
Expand Down

0 comments on commit 2c5ec7e

Please sign in to comment.