Files
next-web/src/components/Navbar.tsx
T

175 lines
5.5 KiB
TypeScript
Raw Normal View History

2025-06-30 15:54:10 -04:00
"use client";
import React, { useState, useEffect } from 'react';
import classnames from 'classnames';
import Link from 'next/link';
import Button from './Button';
import Image from 'next/image';
2025-07-02 16:39:16 -04:00
import Dropdown from "./Dropdown";
export interface MenuItem {
2025-07-03 13:35:22 -04:00
id: string;
2025-07-02 16:39:16 -04:00
title: string;
route?: string;
children?: MenuItem[];
}
2025-07-10 11:52:38 -04:00
// const menuItems: MenuItem[] = [
// {
// id: "members",
// title: "Members",
// children: [
// {
// id: "findMedicalProvider",
// title: "Find a Medical Provider",
// route: "",
// },
// {
// id: "obtainRxInformation",
// title: "Obtain Rx Information",
// route: "",
// },
// ],
// },
// {
// id: "employers",
// title: "Employers",
// children: [
// {
// id: "employerServices",
// title: "Employer Services",
// route: "",
// },
// {
// id: "selfFundedPlans",
// title: "Self-Funded Plans",
// route: "",
// },
// {
// id: "controlHealthCareCosts",
// title: "Control Health Care Costs",
// route: "",
// },
// ],
// },
// {
// id: "providers",
// title: "Providers",
// children: [
// {
// id: "eligibilityLookup",
// title: "Eligibility Lookup",
// route: "",
// },
// {
// id: "contactBbs",
// title: "Contact BBS",
// route: "",
// },
// ],
// },
// {
// id: "brokers",
// title: "Brokers",
// route: "",
// },
// ];
2025-06-30 15:54:10 -04:00
const Navbar = () => {
const [isScrolled, setIsScrolled] = useState(false);
useEffect(() => {
const handleScroll = () => {
2025-07-08 14:57:06 -04:00
const subtractedHeight = window.innerHeight - 80;
if (window.scrollY > subtractedHeight) {
2025-06-30 15:54:10 -04:00
setIsScrolled(true);
} else {
setIsScrolled(false);
}
};
window.addEventListener('scroll', handleScroll);
return () => {
window.removeEventListener('scroll', handleScroll);
};
}, []);
return (
2025-07-10 11:52:38 -04:00
<nav className="sticky top-0 left-0 z-10 hidden lg:flex h-[85px] justify-center bg-transparent">
2025-06-30 15:54:10 -04:00
<div className={classnames(
"w-11/12 bg-britton-neutral px-1 text-britton-dark rounded-b-3xl", {
2025-07-08 14:57:06 -04:00
"h-13 pb-1 border-b-2 border-x-2 border-black" : isScrolled,
"h-full pb-4" : !isScrolled
2025-06-30 15:54:10 -04:00
}
)}
>
<div className="container mx-auto justify-between items-center flex">
2025-07-08 14:57:06 -04:00
<div className={classnames('rounded-b-2xl bg-britton-dark w-72', {"hidden" : isScrolled})}>
2025-06-30 15:54:10 -04:00
<Image
src="/images/bbstpa-forsite.png"
alt="Britton Logo"
2025-07-03 13:35:22 -04:00
width={205}
height={60}
2025-06-30 15:54:10 -04:00
/>
</div>
2025-07-08 14:57:06 -04:00
<div className={classnames('rounded-b-2xl py-2 mb-1 bg-britton-dark font-semibold text-britton-neutral text-center text-lg uppercase w-72', {"hidden" : !isScrolled})}>
<Link href="/">
Britton Benefit Services
</Link>
</div>
2025-07-10 11:52:38 -04:00
<ul className={classnames("flex space-x-4 font-semibold text-xl", {"pl-2" : isScrolled})}>
2025-06-30 15:54:10 -04:00
<li>
2025-07-10 11:52:38 -04:00
<Link href="/" className="hover:text-britton-light">
2025-06-30 15:54:10 -04:00
Employers
</Link>
</li>
<li>
2025-07-10 11:52:38 -04:00
<Link href="/" className="hover:text-britton-light">
2025-06-30 15:54:10 -04:00
Members
</Link>
</li>
<li>
2025-07-10 11:52:38 -04:00
<Link href="/" className="hover:text-britton-light">
2025-06-30 15:54:10 -04:00
Providers
</Link>
</li>
<li>
2025-07-10 11:52:38 -04:00
<Link href="/" className="hover:text-britton-light">
2025-06-30 15:54:10 -04:00
Brokers
</Link>
</li>
<li>
2025-07-10 11:52:38 -04:00
<Link href="/" className="hover:text-britton-light">
Services
2025-06-30 15:54:10 -04:00
</Link>
</li>
2025-07-10 11:52:38 -04:00
</ul>
{/* <div className={classnames("flex space-x-4 font-semibold text-lg", {"pl-2" : isScrolled})}>
2025-07-02 16:39:16 -04:00
{menuItems.map((item) => {
return item.hasOwnProperty("children") ?
(
<Dropdown item={item} />
) : (
<Link className="hover:text-britton-light" href={item?.route || ""}>
{item.title}
</Link>
);
})}
2025-07-10 11:52:38 -04:00
</div> */}
<div className={classnames("flex space-x-2 font-semibold", {"pt-1" : isScrolled})}>
<Button className="bg-britton-neutral text-britton-accent2 hover:text-britton-accent py-1 px-4 rounded border-1 border-britton-accent2 hover:border-britton-accent">
2025-06-30 15:54:10 -04:00
Sign In
</Button>
<Button className="bg-britton-dark hover:bg-britton-medium text-britton-light py-1 px-4 rounded">
Get a Quote
</Button>
</div>
</div>
</div>
</nav>
);
};
export default Navbar;