diff --git a/.changeset/brown-monkeys-lie.md b/.changeset/brown-monkeys-lie.md new file mode 100644 index 00000000000..7955ef500e8 --- /dev/null +++ b/.changeset/brown-monkeys-lie.md @@ -0,0 +1,5 @@ +--- +'@graphcommerce/next-ui': patch +--- + +Support beforeHeader in LayoutDefault without breaking the CartFab and CompareFab. diff --git a/.changeset/kind-drinks-relax.md b/.changeset/kind-drinks-relax.md new file mode 100644 index 00000000000..346c268209a --- /dev/null +++ b/.changeset/kind-drinks-relax.md @@ -0,0 +1,5 @@ +--- +'@graphcommerce/next-ui': patch +--- + +Solve issue if LayoutDefault-children wouldn't fill the page, the content would be aligned to the footer. Presence of beforeheader would trigger this. diff --git a/examples/magento-graphcms/components/Layout/LayoutNavigation.tsx b/examples/magento-graphcms/components/Layout/LayoutNavigation.tsx index 4b967b6fb1c..73b523e41d4 100644 --- a/examples/magento-graphcms/components/Layout/LayoutNavigation.tsx +++ b/examples/magento-graphcms/components/Layout/LayoutNavigation.tsx @@ -21,15 +21,17 @@ import { NavigationOverlay, useNavigationSelection, useMemoDeep, + Container, MobileTopRight, } from '@graphcommerce/next-ui' import { i18n } from '@lingui/core' import { Trans } from '@lingui/react' -import { Divider, Fab } from '@mui/material' +import { Divider, Fab, Link } from '@mui/material' import { useRouter } from 'next/router' import { Footer } from './Footer' import { LayoutQuery } from './Layout.gql' import { Logo } from './Logo' +import { StickyBox } from '@graphcommerce/framer-utils' import { productListRenderer } from '../ProductListItems/productListRenderer' export type LayoutNavigationProps = LayoutQuery & @@ -106,7 +108,45 @@ export function LayoutNavigation(props: LayoutNavigationProps) { ({ + [theme.breakpoints.up('md')]: { + '& .sticky': { + bgcolor: 'background.default', + boxShadow: 1, + }, + }, + })} + // stickyHeader={router.asPath.split('?')[0] !== '/'} + stickyAfterHeader + // stickyBeforeHeader + beforeHeader={ + + You are looking at the{' '} + + GraphCommerce + {' '} + demo + + } + afterHeader={ + + This is a demo store, no actual products are being shipped. + + } header={ <> @@ -151,8 +191,7 @@ export function LayoutNavigation(props: LayoutNavigationProps) { } /> - {/* The placeholder exists because the CartFab is sticky but we want to reserve the space for the */} - {cartEnabled && } + @@ -160,8 +199,8 @@ export function LayoutNavigation(props: LayoutNavigationProps) { } - footer={