From 8b58e655a0f9207fc86bf8a99686d5767bb25897 Mon Sep 17 00:00:00 2001 From: Lucas Scharenbroich Date: Wed, 27 Dec 2023 15:37:02 -0600 Subject: [PATCH] fix(header): fixes #26; navigation list display bug in mobile view --- src/components/AppHeader/AppHeader.tsx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/components/AppHeader/AppHeader.tsx b/src/components/AppHeader/AppHeader.tsx index f8ac1de..ae74f6c 100644 --- a/src/components/AppHeader/AppHeader.tsx +++ b/src/components/AppHeader/AppHeader.tsx @@ -120,10 +120,14 @@ const AppHeader: React.FC = ({ pathname, allAgencyNames }) => { } }; - const chunkAgencyLinks = (groupAgencies: ReactNode[]) => { - return groupAgencies.length > NUMBER_SUB_NAV_LINKS_PER_COLUMN - ? chunkArray(groupAgencies, NUMBER_SUB_NAV_LINKS_PER_COLUMN) - : [[groupAgencies]]; + const chunkAgencyLinks = (groupAgencies: ReactNode[], isMobile: boolean) => { + if (!isMobile) { + return groupAgencies.length > NUMBER_SUB_NAV_LINKS_PER_COLUMN + ? chunkArray(groupAgencies, NUMBER_SUB_NAV_LINKS_PER_COLUMN) + : [[groupAgencies]]; + } else { + return [[groupAgencies]]; + } }; /* @@ -191,6 +195,7 @@ const AppHeader: React.FC = ({ pathname, allAgencyNames }) => { const toggleIndex = i; const subNavLinksArray = chunkAgencyLinks( groupAgencyLinks(allAgencyNames, range), + mobileNavOpen, ); return (