steep components
All components

ReorderButton

Account-page "Reorder" button that re-adds a past order to cart.

components/reorder-button.tsxPeer deps: lucide-react

Live preview

Usage

import { ReorderButton } from "@/components/reorder-button";

<ReorderButton
  items={pastOrder.items.map((i) => ({
    productId: i.product_id,
    name: i.name,
    slug: i.slug,
    priceCents: i.price_cents,
    quantity: i.quantity,
    imageUrl: i.image_url,
  }))}
  onReorder={async (items) => {
    items.forEach((i) => cartStore.add(i));
    router.push("/cart");
  }}
/>