From 84ceb993fd29b14e5354e50fc45baf2eb543c72b Mon Sep 17 00:00:00 2001 From: Bram van der Holst Date: Thu, 28 May 2026 14:15:10 +0200 Subject: [PATCH 1/6] feat(header-v2): move old LayoutNavigation to LayoutNavigationLegacy --- .../Layout/{LayoutNavigation.tsx => LayoutNavigationLegacy.tsx} | 0 examples/magento-graphcms/components/Layout/index.ts | 2 +- .../Layout/{LayoutNavigation.tsx => LayoutNavigationLegacy.tsx} | 0 examples/magento-open-source/components/Layout/index.ts | 2 +- .../Layout/{LayoutNavigation.tsx => LayoutNavigationLegacy.tsx} | 0 examples/magento-storyblok/components/Layout/index.ts | 2 +- 6 files changed, 3 insertions(+), 3 deletions(-) rename examples/magento-graphcms/components/Layout/{LayoutNavigation.tsx => LayoutNavigationLegacy.tsx} (100%) rename examples/magento-open-source/components/Layout/{LayoutNavigation.tsx => LayoutNavigationLegacy.tsx} (100%) rename examples/magento-storyblok/components/Layout/{LayoutNavigation.tsx => LayoutNavigationLegacy.tsx} (100%) diff --git a/examples/magento-graphcms/components/Layout/LayoutNavigation.tsx b/examples/magento-graphcms/components/Layout/LayoutNavigationLegacy.tsx similarity index 100% rename from examples/magento-graphcms/components/Layout/LayoutNavigation.tsx rename to examples/magento-graphcms/components/Layout/LayoutNavigationLegacy.tsx diff --git a/examples/magento-graphcms/components/Layout/index.ts b/examples/magento-graphcms/components/Layout/index.ts index 95af573c2c1..9a6efa3deb4 100644 --- a/examples/magento-graphcms/components/Layout/index.ts +++ b/examples/magento-graphcms/components/Layout/index.ts @@ -1,4 +1,4 @@ -export * from './LayoutNavigation' +export * from './LayoutNavigationLegacy' export * from './LayoutMinimal' export * from './LayoutOverlay' export * from './Layout.gql' diff --git a/examples/magento-open-source/components/Layout/LayoutNavigation.tsx b/examples/magento-open-source/components/Layout/LayoutNavigationLegacy.tsx similarity index 100% rename from examples/magento-open-source/components/Layout/LayoutNavigation.tsx rename to examples/magento-open-source/components/Layout/LayoutNavigationLegacy.tsx diff --git a/examples/magento-open-source/components/Layout/index.ts b/examples/magento-open-source/components/Layout/index.ts index 95af573c2c1..9a6efa3deb4 100644 --- a/examples/magento-open-source/components/Layout/index.ts +++ b/examples/magento-open-source/components/Layout/index.ts @@ -1,4 +1,4 @@ -export * from './LayoutNavigation' +export * from './LayoutNavigationLegacy' export * from './LayoutMinimal' export * from './LayoutOverlay' export * from './Layout.gql' diff --git a/examples/magento-storyblok/components/Layout/LayoutNavigation.tsx b/examples/magento-storyblok/components/Layout/LayoutNavigationLegacy.tsx similarity index 100% rename from examples/magento-storyblok/components/Layout/LayoutNavigation.tsx rename to examples/magento-storyblok/components/Layout/LayoutNavigationLegacy.tsx diff --git a/examples/magento-storyblok/components/Layout/index.ts b/examples/magento-storyblok/components/Layout/index.ts index 95af573c2c1..9a6efa3deb4 100644 --- a/examples/magento-storyblok/components/Layout/index.ts +++ b/examples/magento-storyblok/components/Layout/index.ts @@ -1,4 +1,4 @@ -export * from './LayoutNavigation' +export * from './LayoutNavigationLegacy' export * from './LayoutMinimal' export * from './LayoutOverlay' export * from './Layout.gql' From af0fb441646901271c088ab9f68122351e75df98 Mon Sep 17 00:00:00 2001 From: Bram van der Holst Date: Thu, 28 May 2026 14:20:23 +0200 Subject: [PATCH 2/6] feat(header-v2): duplicate old LayoutNavigation to be used as new LayoutNavigation Unchaged for now. Changes coming in next commits. --- .../components/Layout/LayoutNavigation.tsx | 174 ++++++++++++++++ .../components/Layout/index.ts | 5 +- .../components/Layout/LayoutNavigation.tsx | 188 ++++++++++++++++++ .../components/Layout/index.ts | 5 +- .../components/Layout/LayoutNavigation.tsx | 184 +++++++++++++++++ .../components/Layout/index.ts | 5 +- 6 files changed, 558 insertions(+), 3 deletions(-) create mode 100644 examples/magento-graphcms/components/Layout/LayoutNavigation.tsx create mode 100644 examples/magento-open-source/components/Layout/LayoutNavigation.tsx create mode 100644 examples/magento-storyblok/components/Layout/LayoutNavigation.tsx diff --git a/examples/magento-graphcms/components/Layout/LayoutNavigation.tsx b/examples/magento-graphcms/components/Layout/LayoutNavigation.tsx new file mode 100644 index 00000000000..89a5fa95457 --- /dev/null +++ b/examples/magento-graphcms/components/Layout/LayoutNavigation.tsx @@ -0,0 +1,174 @@ +import { CartFab, useCartEnabled } from '@graphcommerce/magento-cart' +import { magentoMenuToNavigation } from '@graphcommerce/magento-category' +import { CustomerFab, CustomerMenuFabItem } from '@graphcommerce/magento-customer' +import { SearchFab, SearchField } from '@graphcommerce/magento-search' +import { WishlistFab, WishlistMenuFabItem } from '@graphcommerce/magento-wishlist' +import { + DesktopNavActions, + DesktopNavBar, + LayoutDefault, + LayoutDefaultProps, + iconCustomerService, + iconHeart, + NavigationFab, + MenuFabSecondaryItem, + PlaceholderFab, + IconSvg, + DesktopNavItem, + DarkLightModeMenuSecondaryItem, + iconChevronDown, + NavigationProvider, + NavigationOverlay, + useNavigationSelection, + useMemoDeep, + MobileTopRight, +} from '@graphcommerce/next-ui' +import { t } from '@lingui/core/macro' +import { Trans } from '@lingui/react/macro' +import { Divider, Fab } from '@mui/material' +import { useRouter } from 'next/router' +import { Footer } from './Footer' +import { LayoutQuery } from './Layout.gql' +import { Logo } from './Logo' +import { productListRenderer } from '../ProductListItems/productListRenderer' +import { + StoreSwitcherButton, + StoreSwitcherFab, + StoreSwitcherMenuFabSecondaryItem, +} from '@graphcommerce/magento-store' + +export type LayoutNavigationProps = LayoutQuery & + Omit + +export function LayoutNavigation(props: LayoutNavigationProps) { + const { footer, menu, children, ...uiProps } = props + + const selection = useNavigationSelection() + const router = useRouter() + const cartEnabled = useCartEnabled() + + return ( + <> + [ + { id: 'home', name: Home, href: '/' }, + { + id: 'manual-item-one', + href: `/${menu?.items?.[0]?.children?.[0]?.url_path}`, + name: menu?.items?.[0]?.children?.[0]?.name ?? '', + }, + { + id: 'manual-item-two', + href: `/${menu?.items?.[0]?.children?.[1]?.url_path}`, + name: menu?.items?.[0]?.children?.[1]?.name ?? '', + }, + ...magentoMenuToNavigation(menu, true), + { id: 'blog', name: 'Blog', href: '/blog' }, + ({ my: theme.spacings.xs })} />, + selection.set(false)} + key='account' + guestHref='/account/signin' + authHref='/account' + > + Account + , + } + href='/service' + > + Customer Service + , + selection.set(false)} + key='wishlist' + icon={} + > + Wishlist + , + , + , + ], + [menu, selection], + )} + > + + + + + + + + {menu?.items?.[0]?.children?.slice(0, 2).map((item) => ( + + {item?.name} + + ))} + + selection.set([menu?.items?.[0]?.uid || ''])} + onKeyUp={(evt) => { + if (evt.key === 'Enter') { + selection.set([menu?.items?.[0]?.uid || '']) + } + }} + tabIndex={0} + > + {menu?.items?.[0]?.name} + + + + + Blog + + + + + + + + + + } /> + + {/* The placeholder exists because the CartFab is sticky but we want to reserve the space for the */} + {cartEnabled && } + + + + + + + + } + footer={