import React, {useState} from 'react'; import {Link, useIntl} from 'gatsby-plugin-intl'; import { Header, NavMenuButton, PrimaryNav, Grid, Alert, // NavDropDownButton, // Menu, } from '@trussworks/react-uswds'; import BetaBanner from '../BetaBanner'; import J40MainGridContainer from '../J40MainGridContainer'; import GovernmentBanner from '../GovernmentBanner'; import Language from '../Language'; // @ts-ignore import siteLogo from '../../images/j40-logo-v2.png'; import * as styles from './J40Header.module.scss'; import * as COMMON_COPY from '../../data/copy/common'; import {PAGES_ENDPOINTS} from '../../data/constants'; const isAlertValid = new Date < COMMON_COPY.ALERTS.EXPIRATION_DATE; const J40Header = () => { const intl = useIntl(); const titleL1 = intl.formatMessage(COMMON_COPY.HEADER.TITLE_LINE_1); const titleL2 = intl.formatMessage(COMMON_COPY.HEADER.TITLE_LINE_2); /** * State variable to control the mobile menu toggle */ const [mobileNavOpen, setMobileNavOpen] = useState(false); const toggleMobileNav = (): void => setMobileNavOpen((prevOpen) => !prevOpen); /** * The original work of this release called for creating a download page, a FAQ page and TSD page. These * were to be embedded in dropdown menus in the navigation bar of the header. These were all completed. * After discovering that the dropdown component from USWDS was not operating as expected, we decided to * revert to another design. * * It was also decided that some more design was needed and that these pages along with their designs will * be used in the near future. Rather than deleted the code or moving it to another branch, the assumption * was made that since this will be added back in the near term, let's comment it out for now. * * If for some reason we haven't integrated this logic in the near future, this code will be deleted. */ /** * State variable to hold the open/close state of each nav dropdown. There are currently two * dropdowns that are being used, each corresponding to an index in the state array: * * index 0 = Data & Methodology dropdown * index 1 = About dropdown */ // const [isOpen, setIsOpen] = useState([false, false]); // const onToggle = (index: number): void => { // setIsOpen((prevIsOpen) => { // const newIsOpen = [false, false]; // newIsOpen[index] = !prevIsOpen[index]; // return newIsOpen; // }); // }; // const methPageSubNavLinks = [ // // {intl.formatMessage(COMMON_COPY.HEADER.METHODOLOGY)} // , // // {intl.formatMessage(COMMON_COPY.HEADER.DOWNLOADS)} // , // // {intl.formatMessage(COMMON_COPY.HEADER.TSD)} // , // ]; // const aboutSubNavLinks = [ // // {intl.formatMessage(COMMON_COPY.HEADER.ABOUT)} // , // // {intl.formatMessage(COMMON_COPY.HEADER.FAQs)} // , // // {intl.formatMessage(COMMON_COPY.HEADER.PUBLIC_ENG)} // , // ]; const navLinks = [ {intl.formatMessage(COMMON_COPY.HEADER.EXPLORE)} , {intl.formatMessage(COMMON_COPY.HEADER.METHODOLOGY)} , {intl.formatMessage(COMMON_COPY.HEADER.ABOUT)} , // <> // onToggle(0)} // data-cy={'nav-dropdown-methodology'} // className={styles.navDropDownBtn} // > // // // // , // <> // onToggle(1)} // data-cy={'nav-dropdown-about'} // > // // // // , {intl.formatMessage(COMMON_COPY.HEADER.CONTACT)} ,
, ]; return (
{/* Banners */} {/* Logo and Navigation */} {/* Logo */} {`${titleL1} {/* Logo Title */}
{titleL1}
{titleL2}
BETA
{/* Nav links */}
{/* Alert */} {isAlertValid && {COMMON_COPY.ALERTS.CENSUS_TRACT_DESCRIPTION} }
); }; export default J40Header;