'use client'; import type { ReactNode } from 'react'; import { useIsCheckoutRoute } from '@/core/hooks/use-route-chrome'; /** * Hides the site chrome on `/checkout`. * * A checkout page is a funnel: the header menu, the footer (with its contact * form and newsletter box) and the announcement bar are exits, and every one of * them is a place a shopper with a full cart can wander off to. Wrap each of * them in this component and they disappear on `/checkout` and nowhere else. * * * * * * `children` stay server components: this client wrapper only decides whether * to render the already-prepared tree, it does not pull the chrome into the * client bundle. The decision is made from the URL during server rendering too, * so the chrome is absent from the first HTML of `/checkout` (no flash). * * `fallback` renders in its place on `/checkout`. Pass a slim logo-only header * there if the design wants a way back to the store; omit it for nothing. * Works in every language: `/he/checkout` is `/checkout` here. */ export function HideOnCheckout({ children, fallback = null, }: { children: ReactNode; fallback?: ReactNode; }) { return useIsCheckoutRoute() ? <>{fallback} : <>{children}; }