|
|
@@ -1,5 +1,6 @@
|
|
|
import React, {useState} from 'react';
|
|
|
import menuItems from '@/data/menuItems.json';
|
|
|
+import {Link} from "react-router-dom";
|
|
|
|
|
|
const Header = () => {
|
|
|
const [activeIndex, setActiveIndex] = useState(null);
|
|
|
@@ -10,12 +11,16 @@ const Header = () => {
|
|
|
id="sidebar-dimmer"
|
|
|
className={`fixed top-20 left-0 w-full h-full transition-opacity duration-500 ease-in-out ${activeIndex !== null ? 'bg-black/50 opacity-100 pointer-events-auto' : 'opacity-0 pointer-events-none'}`}
|
|
|
/>
|
|
|
-
|
|
|
+
|
|
|
{/* 로고 영역 */}
|
|
|
- <div className="absolute left-[40px] top-[26px] flex items-center gap-1 w-32">
|
|
|
- <img className="w-10 h-7" src='/logo.png' alt='logo'/>
|
|
|
+ <Link
|
|
|
+ to="/"
|
|
|
+ onClick={() => setActiveIndex(null)}
|
|
|
+ className="absolute left-[40px] top-[26px] flex items-center gap-1 w-32"
|
|
|
+ >
|
|
|
+ <img className="w-10 h-7" src="/logo.png" alt="logo"/>
|
|
|
<div className="text-gray-600 text-xl font-bold font-['Inter']">반도산전</div>
|
|
|
- </div>
|
|
|
+ </Link>
|
|
|
|
|
|
{/* 메뉴 영역 */}
|
|
|
<nav className="flex justify-center items-center w-full h-full">
|
|
|
@@ -25,9 +30,11 @@ const Header = () => {
|
|
|
className="relative flex flex-col items-center px-[3vw] cursor-pointer"
|
|
|
onMouseEnter={() => setActiveIndex(index)}
|
|
|
>
|
|
|
- <div className={`relative group font-bold font-['Inter'] cursor-pointer ${activeIndex === index ? 'text-blue-600' : 'text-gray-600'}`}>
|
|
|
+ <div
|
|
|
+ className={`relative group font-bold font-['Inter'] cursor-pointer ${activeIndex === index ? 'text-blue-600' : 'text-gray-600'}`}>
|
|
|
{item.label}
|
|
|
- <span className={`absolute left-0 bottom-[-2px] h-[2px] bg-blue-600 transition-all duration-300 ${activeIndex === index ? 'w-full' : 'w-0'}`}></span>
|
|
|
+ <span
|
|
|
+ className={`absolute left-0 bottom-[-2px] h-[2px] bg-blue-600 transition-all duration-300 ${activeIndex === index ? 'w-full' : 'w-0'}`}></span>
|
|
|
</div>
|
|
|
|
|
|
{activeIndex === index && item.children.length > 0 && (
|
|
|
@@ -36,24 +43,28 @@ const Header = () => {
|
|
|
className="absolute flex flex-col space-y-6 mt-13 pt-4 z-10 bg-blue-900 text-white cursor-pointer"
|
|
|
>
|
|
|
{item.children.map((child, cIdx) => (
|
|
|
- <div
|
|
|
+ <Link
|
|
|
+ to={child.href}
|
|
|
key={cIdx}
|
|
|
- className="relative inline-block text-md text-center font-light font-['Inter'] text-white whitespace-pre-line hover:text-white/80 transition-colors duration-200 group cursor-pointer"
|
|
|
+ className="relative inline-block text-md text-center font-light font-['Inter'] text-white whitespace-pre-line hover:text-white/80 transition-colors duration-200 group"
|
|
|
+ onClick={() => setActiveIndex(null)}
|
|
|
>
|
|
|
<span className="relative">
|
|
|
{child.label}
|
|
|
- <span className="absolute left-0 bottom-[-2px] h-[2px] w-0 bg-white transition-all duration-300 group-hover:w-full"></span>
|
|
|
+ <span
|
|
|
+ className="absolute left-0 bottom-[-2px] h-[2px] w-0 bg-white transition-all duration-300 group-hover:w-full"></span>
|
|
|
</span>
|
|
|
- </div>
|
|
|
+ </Link>
|
|
|
))}
|
|
|
</div>
|
|
|
)}
|
|
|
</div>
|
|
|
))}
|
|
|
</nav>
|
|
|
-
|
|
|
+
|
|
|
{activeIndex !== null && (
|
|
|
- <div id="menuBox" className="absolute w-full h-[50vh] top-20 border bg-blue-900" onMouseLeave={() => setActiveIndex(null)}></div>
|
|
|
+ <div id="menuBox" className="absolute w-full h-[50vh] top-20 border bg-blue-900"
|
|
|
+ onMouseLeave={() => setActiveIndex(null)}></div>
|
|
|
)}
|
|
|
</header>
|
|
|
);
|