'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;