Skip to content

Commit 6ac6d95

Browse files
committed
Update AddToCart.component.tsx
1 parent 1cebd3a commit 6ac6d95

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/components/Product/AddToCart.component.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,18 @@ export interface IProduct {
8080
export interface IProductRootObject {
8181
product: IProduct;
8282
variationId?: number;
83+
fullWidth?: boolean;
8384
}
8485

8586
/**
8687
* Handles the Add to cart functionality.
8788
* Uses GraphQL for product data
8889
* @param {IAddToCartProps} product // Product data
90+
* @param {number} variationId // Variation ID
91+
* @param {boolean} fullWidth // Whether the button should be full-width
8992
*/
9093

91-
const AddToCart = ({ product, variationId }: IProductRootObject) => {
94+
const AddToCart = ({ product, variationId, fullWidth = false }: IProductRootObject) => {
9295
const { setCart } = useContext(CartContext);
9396
const [requestError, setRequestError] = useState<boolean>(false);
9497

@@ -146,6 +149,7 @@ const AddToCart = ({ product, variationId }: IProductRootObject) => {
146149
<Button
147150
handleButtonClick={() => handleAddToCart()}
148151
buttonDisabled={addToCartLoading || requestError}
152+
fullWidth={fullWidth}
149153
>
150154
KJØP
151155
</Button>

0 commit comments

Comments
 (0)