"use client" import { useState } from "react" import { deleteLineItem } from "@lib/data/cart" import { notifyCartUpdated } from "@lib/util/cart-events" import { cn } from "@/lib/utils" import { Trash2, Loader2 } from "lucide-react" const DeleteButton = ({ id, children, className, }: { id: string children?: React.ReactNode className?: string }) => { const [isDeleting, setIsDeleting] = useState(false) const handleDelete = async (id: string) => { setIsDeleting(true) await deleteLineItem(id) .then(notifyCartUpdated) .catch((_err) => { setIsDeleting(false) }) } return (
) } export default DeleteButton