From c53866252ee941b1258b10b35fb688988f14d874 Mon Sep 17 00:00:00 2001 From: RizqiSyahrendra Date: Wed, 12 Mar 2025 11:22:18 +0700 Subject: [PATCH] fix: header nav shadow and hover animation --- public/assets/css/custom.css | 5 ++--- public/assets/css/style.css | 2 +- src/app/globals.css | 4 ++++ src/components/HeaderNav.tsx | 17 +++++++++++------ 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/public/assets/css/custom.css b/public/assets/css/custom.css index ba7a1cf..79f45ec 100644 --- a/public/assets/css/custom.css +++ b/public/assets/css/custom.css @@ -20,13 +20,12 @@ .dark .light-mode-logo { display: none; } -@media (min-width: 1025px) { +/* @media (min-width: 1025px) { .mn-has-sub:hover + *, .mn-has-sub + *:hover { - display: block !important; z-index: 1; } -} +} */ .fadeInText { animation: animationFadeText 0.5s linear 0s 1; diff --git a/public/assets/css/style.css b/public/assets/css/style.css index dc52a98..71f815e 100644 --- a/public/assets/css/style.css +++ b/public/assets/css/style.css @@ -3924,7 +3924,7 @@ a.logo:hover { transition: var(--transition-default); } .mn-sub { - display: none; + /* opacity: 0; */ width: 220px; position: absolute; top: 100%; diff --git a/src/app/globals.css b/src/app/globals.css index 861b538..fbd2cb1 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -63,6 +63,10 @@ body { .ext-btn-shadow-sm-primary8 { @apply bg-extColorPrimary8 text-white hover:text-white hover:bg-extColorPrimary6 transition-colors; } + + .shadow-nav { + @apply !shadow-[0px_0px_10px_0px_rgba(0,0,0,0.24)]; + } } .bg-gradient { diff --git a/src/components/HeaderNav.tsx b/src/components/HeaderNav.tsx index d8105bd..c259470 100644 --- a/src/components/HeaderNav.tsx +++ b/src/components/HeaderNav.tsx @@ -10,6 +10,8 @@ import { Fragment, useEffect, useRef, useState } from "react"; import { FaCaretDown, FaCaretRight } from "react-icons/fa"; export default function HeaderNav({ links, animateY = false }: { links: typeof navMenuData; animateY?: boolean }) { + const [hoveredNavItem, setHoveredNavItem] = useState(""); + const [hoveredSubNavItem, setHoveredSubNavItem] = useState(""); const [isDropdownOpen, setIsDropdownOpen] = useState([""]); const dropdownRef = useRef(null); @@ -59,7 +61,7 @@ export default function HeaderNav({ links, animateY = false }: { links: typeof n )} {Array.isArray(link?.child) && ( - <> +
setHoveredNavItem(`${index}`)} onMouseLeave={() => setHoveredNavItem("")}> {link.text} -
    {link.child.map((subLink: any, subLinkIdx: number) => ( -
  • +
  • setHoveredSubNavItem(`${index}-${subLinkIdx}`)} + onMouseLeave={() => setHoveredSubNavItem("")} + > {!Array.isArray(subLink?.child) && (
      {subLink.child.map((subLink2: any, subLinkIdx2: number) => (
    • @@ -113,7 +118,7 @@ export default function HeaderNav({ links, animateY = false }: { links: typeof n
    • ))}
    - +
)} {index != links.length - 1 && (