From e19dde574a7f3de0c0ad8346ef9a8c3a838a1870 Mon Sep 17 00:00:00 2001 From: HoangKyPham Date: Thu, 3 Dec 2026 15:05:15 +0700 Subject: [PATCH 1/7] Start the announcement bar, the nav and the footer on the same column MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The three rows stack directly on top of one another and each carried its own copy of the gutters to measure its content against. They had drifted. The footer stopped widening at `lg` where the nav carries on to `xl`, and its fixed variant held `px-6` where the nav holds `px-10`; the announcement bar was not on the variants at all, sitting on a `px-5 md:px-8 xl:px-10` of its own that answered to no setting. So on a wide viewport the bar, the logo and the footer's first column each began at a different place. One definition now, in `container.ts`, with `padding` for the full-bleed element that paints the row's background and `width` for the content inside it — separate variants rather than one class list because they go on different elements. The announcement bar reads `headerWidth` rather than gaining a setting of its own. It has no width of its own to speak of: it sits above the nav and what a merchant means by moving the nav to Stretch is that the top of the page is wider, not that the nav alone is. Note that `footerWidth` and `headerWidth` are still two settings, and a shop that has set them differently will still see the footer leave the nav's column — that is the merchant's choice to make in Studio now rather than something the code decides for them. --- app/components/layout/container.ts | 31 +++++++++++++++++++ app/components/layout/footer.tsx | 21 ++----------- app/components/layout/header.tsx | 21 ++----------- .../layout/scrolling-announcement.tsx | 17 ++++++++-- 4 files changed, 52 insertions(+), 38 deletions(-) create mode 100644 app/components/layout/container.ts diff --git a/app/components/layout/container.ts b/app/components/layout/container.ts new file mode 100644 index 00000000..8d5b8f19 --- /dev/null +++ b/app/components/layout/container.ts @@ -0,0 +1,31 @@ +import { cva } from "class-variance-authority"; + +/** + * The gutters and maximum width the announcement bar, the nav and the footer + * all measure their content against. + * + * Each of the three carried its own copy and they had drifted apart. The + * footer stopped widening its gutter at `lg` where the nav carries on to + * `xl`, and the announcement bar sat on a gutter of its own at every size — + * so three rows stacked directly on top of one another started their content + * on three different columns. One definition keeps them on the same column + * whatever width the merchant has chosen. + * + * `padding` goes on the full-bleed element that paints the row's background, + * `width` on the content inside it, which is why they are separate variants + * rather than one class list. + */ +export const layoutWidth = cva("", { + variants: { + width: { + full: "h-full w-full", + stretch: "h-full w-full", + fixed: "mx-auto h-full w-full max-w-(--page-width)", + }, + padding: { + full: "", + stretch: "px-3 md:px-10 xl:px-16", + fixed: "mx-auto px-5 md:px-6 xl:px-10", + }, + }, +}); diff --git a/app/components/layout/footer.tsx b/app/components/layout/footer.tsx index c335d8bc..2150eaa7 100644 --- a/app/components/layout/footer.tsx +++ b/app/components/layout/footer.tsx @@ -1,6 +1,5 @@ import * as Accordion from "@radix-ui/react-accordion"; import { useThemeSettings, useTranslation } from "@weaverse/hydrogen"; -import { cva } from "class-variance-authority"; import clsx from "clsx"; import { useFetcher, useRouteLoaderData } from "react-router"; import { CompanyLocationButton } from "~/components/b2b/company-location-button"; @@ -19,23 +18,9 @@ import { VisaIcon, } from "../icons"; import Link from "../link"; +import { layoutWidth } from "./container"; import { CountrySelector } from "./country-selector"; -const variants = cva("", { - variants: { - width: { - full: "", - stretch: "", - fixed: "mx-auto max-w-(--page-width)", - }, - padding: { - full: "", - stretch: "px-3 md:px-10 lg:px-16", - fixed: "mx-auto px-5 md:px-6 lg:px-6", - }, - }, -}); - // Traced from the Figma newsletter assets. Like the divider star these are // stroked paths (stroke-width 2 on an 18px viewBox), so Phosphor's filled // outlines are not a match. @@ -182,10 +167,10 @@ export function Footer() {