Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion app/components/cart/cart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1089,9 +1089,15 @@ function CartEmpty({
{t("cart.startShopping")}
</Link>
</div>
{/* `medium` is page rhythm — `py-8 md:py-12 lg:py-16`, and those
breakpoints read the viewport, not this 400px drawer, so on a desktop
it took the 64px step. Stacked on the wrapper's own `space-y-12` that
put 112px of nothing between Start Shopping and the best sellers. The
drawer keeps the wrapper's 48px and nothing further; the cart page is
a page and still wants the page rhythm. */}
<Section
width={layout === "drawer" ? "full" : "fixed"}
verticalPadding="medium"
verticalPadding={layout === "drawer" ? "none" : "medium"}
>
<div className="grid gap-4">
<CartBestSellers
Expand Down
2 changes: 1 addition & 1 deletion app/components/customer/outlet-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export function OutletModal({
}
aria-describedby={undefined}
>
<div className="relative w-[500px] max-w-[90vw] bg-(--color-background) px-6 py-3">
<div className="relative w-[500px] max-w-[90vw] rounded-2xl bg-(--color-background) px-6 py-3">
<VisuallyHidden.Root asChild>
<Dialog.Title>{t("account.modalTitle")}</Dialog.Title>
</VisuallyHidden.Root>
Expand Down
31 changes: 31 additions & 0 deletions app/components/layout/container.ts
Original file line number Diff line number Diff line change
@@ -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",
},
},
});
2 changes: 1 addition & 1 deletion app/components/layout/country-selector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export function CountrySelector({
it flush against the edge. Aligning to the start lines its left
edge up with the trigger, which is what the design shows. */}
<Popover.Content align="start" collisionPadding={16}>
<div className="my-2 max-h-40 w-80 overflow-auto bg-neutral-800 py-2">
<div className="my-2 max-h-40 w-80 overflow-auto rounded-2xl bg-neutral-800 py-2">
{localeOptions.map((locale) => {
const isSelected =
mode === "language"
Expand Down
2 changes: 1 addition & 1 deletion app/components/layout/dropdown-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export function DropdownMenu({ menuItem }: { menuItem: SingleMenuItem }) {
</Trigger>
<Content
align="start"
className="flex min-w-48 animate-fade-in flex-col gap-1.5 rounded-lg bg-(--color-header-bg) p-6 shadow-lg"
className="flex min-w-48 animate-fade-in flex-col gap-1.5 rounded-2xl bg-(--color-header-bg) p-6 shadow-lg"
onCloseAutoFocus={(e) => e.preventDefault()}
>
{childItems.map(
Expand Down
73 changes: 29 additions & 44 deletions app/components/layout/footer.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ArrowRightIcon } from "@phosphor-icons/react";
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";
Expand All @@ -18,27 +18,14 @@ import {
PaypalIcon,
VisaIcon,
} from "../icons";
import Link from "../link";
import Link, { variants } 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.
// Traced from the Figma newsletter asset. Like the divider star it is a
// stroked path (stroke-width 2 on an 18px viewBox), so Phosphor's filled
// outlines are not a match. The Send arrow beside it is the opposite case:
// the design draws Phosphor's filled ArrowRight, so that one is imported.
function MailIcon() {
return (
<svg
Expand All @@ -59,26 +46,6 @@ function MailIcon() {
);
}

function ArrowRightIcon() {
return (
<svg
aria-hidden
fill="none"
height="18"
viewBox="0 0 18 18"
width="18"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M3.7494 9H14.2506M9 14.2506L14.2506 9L9 3.7494"
stroke="currentColor"
strokeLinecap="round"
strokeWidth="2"
/>
</svg>
);
}

// Traced from the Figma divider asset. Not a Phosphor glyph: it is a stroked
// path (stroke-width 2 on a 20px viewBox), while Phosphor draws filled outlines.
function StarDividerIcon() {
Expand Down Expand Up @@ -182,10 +149,10 @@ export function Footer() {
<footer
className={cn(
"w-full bg-(--color-footer-bg) pt-9 text-(--color-footer-text) lg:pt-16",
variants({ padding: footerWidth }),
layoutWidth({ padding: footerWidth }),
)}
>
<div className={cn("h-full w-full", variants({ width: footerWidth }))}>
<div className={layoutWidth({ width: footerWidth })}>
<div className="pb-10">
<div className="flex w-full flex-col gap-16 md:flex-row md:gap-6 lg:gap-16">
{/* Brand */}
Expand Down Expand Up @@ -254,13 +221,31 @@ export function Footer() {
className="min-w-0 grow bg-transparent text-[#F1F1E6] text-base placeholder:text-[#A79D95] focus-visible:outline-hidden"
/>
</div>
{/* Figma nodes 1232-25676 (1440), 4549-7639 (834) and
6964-12199 (390): the design draws this as the theme's
Secondary button, so it takes that variant rather than
its own colours — the merchant's button settings then
reach it like every other button. The variant's 18px
vertical padding makes it 50px tall against the 48px
field, which is what the design shows; the row centres
them.

It keeps its content width at every size, 107px in all
three frames. On the narrow one the design stacks it
under the field rather than stretching it across, which
is what the column's `items-start` gives it. */}
<button
type="submit"
disabled={fetcher.state === "submitting"}
className="flex h-12 w-full shrink-0 items-center justify-center gap-2 rounded-[12px] bg-[#F1F1E6] px-4 font-bold text-[#2B2620] text-base transition-opacity hover:opacity-90 disabled:opacity-50 sm:w-auto"
className={cn(
variants({ variant: "secondary" }),
// `leading-none` is restated because `text-sm` carries a line height of
// its own in Tailwind v4, which merges out the one the variant set.
"shrink-0 gap-2 text-sm leading-none tracking-[0.28px] disabled:opacity-50",
)}
>
{newsletterButtonText}
<ArrowRightIcon />
<ArrowRightIcon className="size-3.5" />
</button>
</div>
</fetcher.Form>
Expand Down
21 changes: 3 additions & 18 deletions app/components/layout/header.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { MagnifyingGlassIcon, UserIcon } from "@phosphor-icons/react";
import { useThemeSettings } from "@weaverse/hydrogen";
import { cva } from "class-variance-authority";
import clsx from "clsx";
import { Suspense, useSyncExternalStore } from "react";
import {
Expand All @@ -15,28 +14,14 @@ import type { RootLoader } from "~/root";
import { cn } from "~/utils/cn";
import { DEFAULT_LOCALE } from "~/utils/const";
import { CartDrawer } from "./cart-drawer";
import { layoutWidth } from "./container";
import { DesktopMenu } from "./desktop-menu";
import { MobileMenu } from "./mobile-menu";
import {
PredictiveSearchButton,
toggleSearchDrawer,
} from "./predictive-search";

const variants = 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",
},
},
});

function useIsHomeCheck() {
const { pathname } = useLocation();
const rootData = useRouteLoaderData<RootLoader>("root");
Expand Down Expand Up @@ -78,7 +63,7 @@ export function Header() {
"bg-(--color-header-bg) hover:bg-(--color-header-bg)",
"text-(--color-header-text) hover:text-(--color-header-text)",
"border-line-subtle border-b",
variants({ padding: headerWidth }),
layoutWidth({ padding: headerWidth }),
scrolled ? "shadow-header" : "shadow-none",
enableTransparent
? [
Expand All @@ -105,7 +90,7 @@ export function Header() {
style={{ height: "var(--height-nav)" }}
className={cn(
"flex items-center justify-between gap-2 py-1.5 xl:gap-8 xl:py-3",
variants({ width: headerWidth }),
layoutWidth({ width: headerWidth }),
)}
>
<MobileMenu />
Expand Down
17 changes: 15 additions & 2 deletions app/components/layout/scrolling-announcement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { useThemeSettings } from "@weaverse/hydrogen";
import { useEffect } from "react";
import { CompanyLocationButton } from "~/components/b2b/company-location-button";
import { resolveSocialSlots } from "~/components/layout/social-icons";
import { cn } from "~/utils/cn";
import { layoutWidth } from "./container";

const MAX_DURATION = 20;

Expand All @@ -14,6 +16,9 @@ export function ScrollingAnnouncement() {
topbarBgColor,
topbarScrollingGap,
topbarScrollingSpeed,
// The bar sits directly above the nav, so it measures its content against
// the nav's width rather than a setting of its own.
headerWidth,
} = themeSettings;

function updateStyles() {
Expand Down Expand Up @@ -43,7 +48,10 @@ export function ScrollingAnnouncement() {
return (
<div
id="announcement-bar"
className="relative flex w-full items-center justify-center py-3 xl:py-2"
className={cn(
"relative flex w-full items-center justify-center py-3 xl:py-2",
layoutWidth({ padding: headerWidth }),
)}
style={
{
height: `${topbarHeight}px`,
Expand All @@ -52,7 +60,12 @@ export function ScrollingAnnouncement() {
} as React.CSSProperties
}
>
<div className="mx-auto flex h-full w-full max-w-(--page-width) items-center justify-center px-5 md:px-8 xl:gap-8 xl:px-10">
<div
className={cn(
"flex items-center justify-center xl:gap-8",
layoutWidth({ width: headerWidth }),
)}
>
{/* Left — socials */}
<div className="hidden flex-1 items-center gap-3 xl:flex">
{socials.map(({ key, name, to, Icon }) => (
Expand Down
2 changes: 1 addition & 1 deletion app/components/product/product-media.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ export function ProductMedia(props: ProductMediaProps) {
imageAspectRatio={imageAspectRatio}
index={idx}
className={cn(
"w-full max-w-none object-cover lg:h-full lg:w-full rounded-2xl",
"w-full max-w-none object-cover lg:h-full lg:w-full rounded-2xl bg-line-subtle",
idx === 0 &&
hasSharedTransition &&
"[&_img]:[view-transition-name:image-expand]",
Expand Down
2 changes: 1 addition & 1 deletion app/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
},
"search": {
"label": "Search",
"placeholder": "Search our store...",
"placeholder": "What are you looking for?",
"popular": "Popular searches:",
"tabProducts": "Products",
"tabCollections": "Collections",
Expand Down
2 changes: 1 addition & 1 deletion app/sections/collection-filters/sort.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export function Sort() {
sideOffset={8}
align="end"
className={cn(
"z-50 flex h-fit w-60 flex-col items-start gap-4 rounded border border-line-subtle bg-background p-6 text-left text-sm leading-[1.6] tracking-[0.28px] uppercase",
"z-50 flex h-fit w-60 flex-col items-start gap-4 rounded-2xl border border-line-subtle bg-background p-6 text-left text-sm leading-[1.6] tracking-[0.28px] uppercase",
"data-[state=open]:animate-scale-in",
"data-[state=closed]:animate-scale-out",
)}
Expand Down
9 changes: 8 additions & 1 deletion app/sections/variant-list/variant-row.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,14 @@ function QuantityUpdateButtons({
);
}

const VOLUME_PRICING_PANEL = "bg-white text-body shadow-lg rounded-lg p-0";
// `overflow-hidden` belongs to the radius rather than to the layout. The panel
// is on `p-0` so the rows run its full width, and `odd:bg-line-subtle` paints
// the last of them square across the bottom corners whenever the count is odd
// — which it is for a variant with no price breaks at all, the commonest case
// of the three. A child's background is not clipped by its parent's
// `border-radius` on its own, and at the old 8px this was too small to see.
const VOLUME_PRICING_PANEL =
"bg-white text-body shadow-lg rounded-2xl overflow-hidden p-0";
const VOLUME_PRICING_ICON =
"cursor-pointer hover:scale-125 duration-300 text-body-subtle";

Expand Down
Loading