"use client"; import { useCart } from "@/lib/cart"; import { CART_DRAWER_ID, closeCartDrawer, configureOpenCartAction } from "@/lib/cart-drawer"; import { content } from "@/lib/content"; import { CartContent } from "./CartContent"; /** * Cart drawer — a native `` + `showModal()` rendered once in the root * layout (`hydrogen-cart-drawer` skill). Opens via `openCartDrawer()`, * `window.Shopify.actions.openCart()`, or after a successful add-to-cart. The * `/cart` route is the no-JS fallback (F4). Uses fixed header/body/footer * zones; the body scrolls, the footer is hidden when the cart is empty. */ export function CartDrawer() { // Ensure the Standard Actions `openCart` handler is registered on the client. configureOpenCartAction(); const totalQuantity = useCart((state) => state.data.totalQuantity); const isEmpty = totalQuantity === 0; const checkoutUrl = useCart((state) => state.data.checkoutUrl); return (

{content.cart.title}

{!isEmpty ? (
{content.cart.checkout}
) : null}
); }