'use client'; import { useState } from 'react'; import { Menu, X } from 'lucide-react'; import { Link } from '@/i18n/routing'; import { ModeToggle } from '@/components/ui/mode-toggle'; import { LanguageToggle } from '@/components/ui/language-toggle'; import { useTranslations } from 'next-intl'; const HEADER_MENU_ITEMS = [ { key: 'about', path: '/#about' }, { key: 'skills', path: '/#skills' }, { key: 'projects', path: '/#projects' }, { key: 'monitoring', path: '/#monitoring' }, { key: 'contact', path: '/#contact' }, ]; const HeaderProfile = () => { return ( handleScrollClick(e, '/#top')} >

MINJO

); }; const handleScrollClick = ( e: React.MouseEvent, path: string, ) => { e.preventDefault(); const sectionId = path.replace('/#', ''); const element = document.getElementById(sectionId); const navbarHeight = 70; if (element) { const elementPosition = element.getBoundingClientRect().top + window.scrollY; const offsetPosition = elementPosition - navbarHeight; window.scrollTo({ top: offsetPosition, behavior: 'smooth' }); } else { // 요소를 찾지 못하면 최상단으로 스크롤 window.scrollTo({ top: 0, behavior: 'smooth' }); } }; const HeaderMenuItemsDesktop = () => { const t = useTranslations('header'); return (
{HEADER_MENU_ITEMS.map((item) => (
handleScrollClick(e, item.path)} className="font-extralight text-xs tablet:text-sm desktop:text-base duration-100 ease-in hover:border-b-2 hover:border-b-black hover:dark:border-b-white pb-1" > {t(item.key)}
))}
); }; const HeaderMenuItemsMobile = () => { const [isOpen, setIsOpen] = useState(false); const t = useTranslations('header'); const handleMenuClick = (e: React.MouseEvent, path: string) => { handleScrollClick(e, path); setIsOpen(false); }; return ( <> {isOpen && (
{HEADER_MENU_ITEMS.map((item) => ( handleMenuClick(e, item.path)} className="text-lg smalltablet:text-xl duration-100 ease-in hover:border-b-2 hover:border-b-brand-primary hover:dark:border-b-white pb-1" > {t(item.key)} ))}
)} ); }; const Header = () => { return (
{/* 모바일: 왼쪽 - 햄버거 아이콘 */}
{/* 모바일: 가운데 - 이름, 태블릿 이상: 왼쪽 - 이름 */}
{/* 모바일: 오른쪽 - 토글 버튼들, 태블릿 이상: 오른쪽 - 메뉴 + 토글 버튼들 */}
); }; export default Header;