fix: HeaderNav types and defect
This commit is contained in:
parent
312e4bed2f
commit
ae9ec00946
@ -1,12 +1,12 @@
|
||||
"use client";
|
||||
|
||||
import { navMenuData } from "@/data/menu";
|
||||
import addScrollspy from "@/utils/addScroll";
|
||||
import { init_classic_menu_resize } from "@/utils/menuToggle";
|
||||
import { scrollToElement } from "@/utils/scrollToElement";
|
||||
import { closeMobileMenu, toggleMobileMenu } from "@/utils/toggleMobileMenu";
|
||||
import { Fragment, useEffect, useRef, useState } from "react";
|
||||
import { toggleMobileMenu } from "@/utils/toggleMobileMenu";
|
||||
import Link from "next/link";
|
||||
import { navMenuData } from "@/data/menu";
|
||||
import { Fragment, useEffect, useRef, useState } from "react";
|
||||
|
||||
export default function HeaderNav({ links, animateY = false }: { links: typeof navMenuData; animateY?: boolean }) {
|
||||
const [isDropdownOpen, setIsDropdownOpen] = useState([""]);
|
||||
@ -36,8 +36,7 @@ export default function HeaderNav({ links, animateY = false }: { links: typeof n
|
||||
|
||||
return (
|
||||
<>
|
||||
{links[0].href?.includes("/") &&
|
||||
links.map((link, index) => (
|
||||
{links.map((link, index) => (
|
||||
<Fragment key={index}>
|
||||
<li>
|
||||
{!Array.isArray(link?.child) && (
|
||||
@ -72,11 +71,8 @@ export default function HeaderNav({ links, animateY = false }: { links: typeof n
|
||||
{Array.isArray(subLink?.child) && (
|
||||
<>
|
||||
<Link href={subLink?.href ?? "#"} className="mn-has-sub">
|
||||
{subLink.text}{" "}
|
||||
<i
|
||||
className="mi-chevron-down"
|
||||
onClick={() => toggleDropdown([link.text, subLink.text])}
|
||||
/>
|
||||
{subLink.text}
|
||||
<i className="mi-chevron-down" onClick={() => toggleDropdown([link.text, subLink.text])} />
|
||||
</Link>
|
||||
|
||||
<ul className={`mn-sub to-right ${isDropdownOpen.includes(subLink.text) && "open"}`}>
|
||||
@ -97,28 +93,13 @@ export default function HeaderNav({ links, animateY = false }: { links: typeof n
|
||||
)}
|
||||
</li>
|
||||
{index != links.length - 1 && (
|
||||
<div className="text-white h-[25px] mx-2 opacity-[0.3]" style={{ border: "1px solid white" }} />
|
||||
<div
|
||||
className="text-white bg-white h-[1px] md:h-[25px] mx-2 opacity-[0.3]"
|
||||
style={{ border: "1px solid white" }}
|
||||
/>
|
||||
)}
|
||||
</Fragment>
|
||||
))}
|
||||
|
||||
{!links[0].href?.includes("/") &&
|
||||
links.map((link: any, index: any) => (
|
||||
<li className="scrollspy-link" key={index}>
|
||||
<a onClick={() => closeMobileMenu()} className="" href={link.href}>
|
||||
{animateY ? (
|
||||
<span className="btn-animate-y">
|
||||
<span className="btn-animate-y-1">{link.text}</span>
|
||||
<span className="btn-animate-y-2" aria-hidden="true">
|
||||
{link.text}
|
||||
</span>
|
||||
</span>
|
||||
) : (
|
||||
link.text
|
||||
)}
|
||||
</a>
|
||||
</li>
|
||||
))}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
@ -1,8 +1,4 @@
|
||||
export const navMenuData = [
|
||||
{ href: "/", text: "Home" },
|
||||
{ href: "/blog", text: "Blog" },
|
||||
{ href: "/testimonials", text: "Testimonials" },
|
||||
{ href: "https://cochise.mdnavigatorclinical.com/prognocistc1/cochiseClinicIndex.html", text: "Patient Portal" },
|
||||
{
|
||||
href: "#",
|
||||
text: "About",
|
||||
@ -68,10 +64,13 @@ export const navMenuData = [
|
||||
},
|
||||
],
|
||||
},
|
||||
{ href: "https://cochise.mdnavigatorclinical.com/prognocistc1/cochiseClinicIndex.html", text: "Patient Portal" },
|
||||
{ href: "/blog", text: "Blog" },
|
||||
{
|
||||
href: "#",
|
||||
text: "Resources",
|
||||
child: [
|
||||
{ href: "/testimonials", text: "Testimonials" },
|
||||
{ href: "/insurances", text: "Insurances" },
|
||||
{ href: "/support", text: "Support Groups" },
|
||||
{ href: "/hospitality-house", text: "Hospitality House" },
|
||||
|
Loading…
x
Reference in New Issue
Block a user