From b4feb81355f9832c5698f81f8fdf33121e0189a5 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 5 Jun 2025 12:45:04 +0000 Subject: Sync from 0947a69192ad6820970902c7c951fb0cf31fcf4b --- src/components/AddToCartForm.tsx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/components/AddToCartForm.tsx (limited to 'src/components/AddToCartForm.tsx') diff --git a/src/components/AddToCartForm.tsx b/src/components/AddToCartForm.tsx new file mode 100644 index 000000000..7498443f6 --- /dev/null +++ b/src/components/AddToCartForm.tsx @@ -0,0 +1,18 @@ +import { isCartOpen, addCartItem } from '../cartStore'; +import type { CartItemDisplayInfo } from '../cartStore'; +import type { ComponentChildren } from 'preact'; + +type Props = { + item: CartItemDisplayInfo; + children: ComponentChildren; +}; + +export default function AddToCartForm({ item, children }: Props) { + function addToCart(e: SubmitEvent) { + e.preventDefault(); + isCartOpen.set(true); + addCartItem(item); + } + + return
{children}
; +} -- cgit v1.2.3