-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #187 from epigram5-9/merge/FE-29
FE-29 🔀 브랜치 최신화
- Loading branch information
Showing
46 changed files
with
642 additions
and
416 deletions.
There are no files selected for viewing
Empty file.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import React, { useState } from 'react'; | ||
import { useRouter } from 'next/router'; | ||
import Image from 'next/image'; | ||
import { useQuery } from '@tanstack/react-query'; | ||
import queries from '@/apis/queries'; | ||
import LOGO_ICON from '../../../public/epigram-icon.png'; | ||
import PROFILE_ICON from '../../../public/icon/user-icon.svg'; | ||
import MENU_ICON from '../../../public/icon/menu-icon.svg'; | ||
import Sidebar from './SideBar'; | ||
|
||
export default function NewHeader() { | ||
const router = useRouter(); | ||
const [isSidebarOpen, setIsSidebarOpen] = useState(false); | ||
|
||
const { data, isLoading, error } = useQuery(queries.user.getMe()); | ||
|
||
const handleNavigateTo = (path: string) => { | ||
router.push(path); | ||
}; | ||
|
||
const getNickName = () => { | ||
if (isLoading) { | ||
return '로딩 중...'; | ||
} | ||
if (error) { | ||
return '에러 발생'; | ||
} | ||
return data?.nickname || '김코드'; | ||
}; | ||
|
||
return ( | ||
<div className='w-full px-6 py-4 bg-white border-b border-line-100 flex items-center gap-2.5 lg:px-[120px] md:px-[72px] md:h-[60px] lg:h-20 md:py-[19px] lg:py-[26px]'> | ||
<div className='flex justify-between items-center w-full md:w-[744px] lg:w-[1920px]'> | ||
<div className='flex items-center gap-3 md:gap-6 lg:gap-9'> | ||
<div className='flex items-center gap-3'> | ||
<button type='button' onClick={() => setIsSidebarOpen(!isSidebarOpen)} className='md:hidden'> | ||
<Image className='w-5 h-5 lg:w-9 lg:h-9' src={MENU_ICON} alt='menu' /> | ||
</button> | ||
<button type='button' onClick={() => handleNavigateTo('/epigrams')} className='flex items-center gap-1'> | ||
<Image className='w-6 h-6 lg:w-9 lg:h-9' src={LOGO_ICON} alt='logo' /> | ||
<span className='text-black-700 text-6 lg:text-[26px] font-montserrat leading-6 font-bold'>Epigram</span> | ||
</button> | ||
</div> | ||
<div className='hidden md:flex items-center gap-6'> | ||
<button type='button' onClick={() => handleNavigateTo('/feed')}> | ||
<div className='text-center text-black-600 text-sm lg:text-base font-semibold font-pretendard leading-normal'>피드</div> | ||
</button> | ||
<button type='button' onClick={() => handleNavigateTo('/search')}> | ||
<div className='text-center text-black-600 text-sm lg:text-base font-semibold font-pretendard leading-normal'>검색</div> | ||
</button> | ||
</div> | ||
</div> | ||
<button type='button' onClick={() => handleNavigateTo('/mypage')} className='flex items-center gap-1.5'> | ||
<div className='w-4 h-4 lg:w-6 lg:h-6 relative'> | ||
<Image src={PROFILE_ICON} alt='프로필 이미지' /> | ||
</div> | ||
<div className='text-gray-300 text-[13px] lg:text-sm font-medium font-pretendard leading-snug'>{getNickName()}</div> | ||
</button> | ||
</div> | ||
<Sidebar isOpen={isSidebarOpen} toggleSidebar={() => setIsSidebarOpen(false)} /> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import React from 'react'; | ||
import Image from 'next/image'; | ||
import { useRouter } from 'next/router'; | ||
import X_ICON from '../../../public/icon/x-icon.svg'; | ||
|
||
interface SidebarProps { | ||
isOpen: boolean; | ||
toggleSidebar: () => void; | ||
} | ||
|
||
function Sidebar({ isOpen, toggleSidebar }: SidebarProps) { | ||
const router = useRouter(); | ||
|
||
const handleNavigateTo = (path: string) => { | ||
router.push(path); | ||
toggleSidebar(); | ||
}; | ||
|
||
if (!isOpen) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<div className='absolute top-0 left-0 h-full w-[220px] bg-white shadow-lg z-50'> | ||
<div className='h-[54px] px-4 py-2.5 bg-white border-b border-[#f2f2f2] flex items-center justify-end'> | ||
<button type='button' onClick={toggleSidebar}> | ||
<Image className='w-6 h-6' src={X_ICON} alt='사이드바 닫기' /> | ||
</button> | ||
</div> | ||
<div className='flex flex-col'> | ||
<button type='button' className='w-full px-5 py-6 bg-white text-left' onClick={() => handleNavigateTo('/feed')}> | ||
<div className='text-[#373737] text-base font-medium font-pretendard leading-relaxed'>피드</div> | ||
</button> | ||
<button type='button' className='w-full px-5 py-6 bg-white text-left' onClick={() => handleNavigateTo('/search')}> | ||
<div className='text-[#373737] text-base font-medium font-pretendard leading-relaxed'>검색</div> | ||
</button> | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
export default Sidebar; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.