<AddToCart/>
A component includes an interactive add to cart button
Example
Coming soon...
Props
Option | Type | Description |
---|---|---|
All button base props | All button base props | All button base props |
textToStatus | TextToStatus (default=defaultTestToStatus) | What text to show on every status |
status | CartStatus | cart submission status |
onAdd | onAddFunc | on button click |
Types
import React from "react"
enum CartStatus {
None = "",
Loading = "loading",
Success = "success",
Failed = "failed"
}
type TextToStatus = Record<CartStatus, string>
const defaultTestToStatus: TextToStatus = {
"": "Add To Cart",
[CartStatus.Loading]: "Adding...",
[CartStatus.Success]: "Added",
[CartStatus.Failed]: "Failed",
}
type onAddFunc = (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void