pixelize-design-library 2.2.79 → 2.2.80
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { ProductCardProps } from "./ProductCardProps";
|
|
3
|
-
declare const ProductCard: ({ id, label, productImage, rating, reviews, tags, options, button, batch, description, avalabilitys, onAddToCart, onNotifyMe, onClick, addToCart, goToCart, OnGoToCart, size, }: ProductCardProps) => React.JSX.Element;
|
|
3
|
+
declare const ProductCard: ({ id, label, productImage, rating, reviews, tags, options, button, batch, description, avalabilitys, onAddToCart, onNotifyMe, onClick, onOptionChange, addToCart, goToCart, OnGoToCart, size, }: ProductCardProps) => React.JSX.Element;
|
|
4
4
|
export default ProductCard;
|
|
@@ -37,11 +37,15 @@ var useCustomTheme_1 = require("../../Theme/useCustomTheme");
|
|
|
37
37
|
var lucide_react_1 = require("lucide-react");
|
|
38
38
|
var ProductCard = function (_a) {
|
|
39
39
|
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
40
|
-
var id = _a.id, label = _a.label, productImage = _a.productImage, rating = _a.rating, reviews = _a.reviews, tags = _a.tags, options = _a.options, button = _a.button, batch = _a.batch, description = _a.description, avalabilitys = _a.avalabilitys, onAddToCart = _a.onAddToCart, onNotifyMe = _a.onNotifyMe, onClick = _a.onClick, addToCart = _a.addToCart, goToCart = _a.goToCart, OnGoToCart = _a.OnGoToCart, _o = _a.size, size = _o === void 0 ? "sm" : _o;
|
|
40
|
+
var id = _a.id, label = _a.label, productImage = _a.productImage, rating = _a.rating, reviews = _a.reviews, tags = _a.tags, options = _a.options, button = _a.button, batch = _a.batch, description = _a.description, avalabilitys = _a.avalabilitys, onAddToCart = _a.onAddToCart, onNotifyMe = _a.onNotifyMe, onClick = _a.onClick, onOptionChange = _a.onOptionChange, addToCart = _a.addToCart, goToCart = _a.goToCart, OnGoToCart = _a.OnGoToCart, _o = _a.size, size = _o === void 0 ? "sm" : _o;
|
|
41
41
|
var _p = (0, react_1.useState)(false), hover = _p[0], setHover = _p[1];
|
|
42
42
|
var theme = (0, useCustomTheme_1.useCustomTheme)();
|
|
43
43
|
var _q = (0, react_1.useState)(options === null || options === void 0 ? void 0 : options[0]), selectedOption = _q[0], setSelectedOption = _q[1];
|
|
44
44
|
var _r = (0, react_1.useState)(1), qty = _r[0], setQty = _r[1];
|
|
45
|
+
var handleOptionSelect = function (option) {
|
|
46
|
+
setSelectedOption(option);
|
|
47
|
+
onOptionChange === null || onOptionChange === void 0 ? void 0 : onOptionChange(option);
|
|
48
|
+
};
|
|
45
49
|
var handleIncrement = function (e) {
|
|
46
50
|
e.stopPropagation();
|
|
47
51
|
if ((selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.stocks) && qty < selectedOption.stocks) {
|
|
@@ -86,7 +90,7 @@ var ProductCard = function (_a) {
|
|
|
86
90
|
react_1.default.createElement(react_2.Box, { onClick: onClick, cursor: "pointer" },
|
|
87
91
|
react_1.default.createElement(ProductLabel_1.default, { label: label, description: description, size: size })),
|
|
88
92
|
tags && react_1.default.createElement(ProductTags_1.default, { tags: tags, size: size }),
|
|
89
|
-
options && react_1.default.createElement(ProductPrice_1.default, { options: options, size: size, onSelect:
|
|
93
|
+
options && react_1.default.createElement(ProductPrice_1.default, { options: options, size: size, onSelect: handleOptionSelect }),
|
|
90
94
|
typeof (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.stocks) === "number" && (react_1.default.createElement(react_2.Badge, { colorScheme: ((_d = selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.stocks) !== null && _d !== void 0 ? _d : 0) >= 5
|
|
91
95
|
? "green"
|
|
92
96
|
: ((_e = selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.stocks) !== null && _e !== void 0 ? _e : 0) > 0
|
|
@@ -15,6 +15,7 @@ export type ProductCardProps = {
|
|
|
15
15
|
};
|
|
16
16
|
onAddToCart?: (id: string | number, var_id: number, qty?: number) => void;
|
|
17
17
|
onNotifyMe?: (id: string | number, var_id: number) => void;
|
|
18
|
+
onOptionChange?: (option: options) => void;
|
|
18
19
|
addToCart?: boolean;
|
|
19
20
|
goToCart?: boolean;
|
|
20
21
|
OnGoToCart?: () => void;
|
|
@@ -3,7 +3,7 @@ import { options, SizeType } from './ProductCardProps';
|
|
|
3
3
|
type ProductPriceProps = {
|
|
4
4
|
options: options[];
|
|
5
5
|
size: SizeType;
|
|
6
|
-
onSelect?:
|
|
6
|
+
onSelect?: (option: options) => void;
|
|
7
7
|
};
|
|
8
8
|
declare const ProductPrice: ({ options, size, onSelect }: ProductPriceProps) => React.JSX.Element;
|
|
9
9
|
export default ProductPrice;
|