Repository URL to install this package:
|
Version:
2.8.4 ▾
|
@skava/ui
/
dist
/
components
/
presets
/
BundleProduct
/
CheckoutCartBundle
/
ProductItem
/
renderProps.js
|
|---|
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
const tslib_1 = require("tslib");
const react_1 = tslib_1.__importDefault(require("react"));
const exotic_1 = require("exotic");
const words_1 = require("../../../../../words");
const Empty_1 = require("../../../../atoms/Empty");
const styled_1 = require("./styled"); // renderButton
function defaultRenderCheckoutButton(props) {
return '';
}
exports.defaultRenderCheckoutButton = defaultRenderCheckoutButton; // renderTotalPrice
function defaultRenderCheckoutTotalPrice(props) {
const {
item
} = props;
const {
totalPrice,
savePrice
} = item;
const savePriceCaption = words_1.wording.youSave + ' ' + savePrice;
return react_1.default.createElement(styled_1.StyledTotalPrice, null, exotic_1.isSafe(totalPrice) ? react_1.default.createElement(styled_1.TotalPrice, null, totalPrice) : react_1.default.createElement(Empty_1.Empty, null), exotic_1.isSafe(savePrice) ? react_1.default.createElement(styled_1.SavePrice, null, savePriceCaption) : react_1.default.createElement(Empty_1.Empty, null));
}
exports.defaultRenderCheckoutTotalPrice = defaultRenderCheckoutTotalPrice; // renderItemPrice
function defaultRenderCheckoutPrice(props) {
const {
item
} = props;
const {
salePrice,
regPrice
} = item;
return react_1.default.createElement(styled_1.StyledItemPrice, {
salePrice: salePrice,
regularPrice: regPrice
});
}
exports.defaultRenderCheckoutPrice = defaultRenderCheckoutPrice; // renderQuantity
function defaultRenderCheckoutQuantity(props) {
const {
onQuantityInputChange
} = props;
const handleQuantityInputChange = changeArgs => {
console.log('[handleQuantityInputChange]', changeArgs);
if (exotic_1.isFunction(onQuantityInputChange)) {
onQuantityInputChange(changeArgs);
}
};
return react_1.default.createElement(styled_1.StyledQuantity, {
defaultValue: 1,
isHeader: false,
onChange: handleQuantityInputChange
});
}
exports.defaultRenderCheckoutQuantity = defaultRenderCheckoutQuantity; // renderProduct
function defaultRenderCheckoutProduct(props) {
const {
item,
index,
productCount
} = props;
const {
image,
brandName,
name,
options,
isBundleSubProduct,
hasAddon,
navigationUrl
} = item;
const captionBgColor = isBundleSubProduct && hasAddon ? '#EA7B0A' : '#195FBF';
const bundleCaption = `${words_1.wording.item} ${index + 1} of ${productCount}`;
const caption = isBundleSubProduct && hasAddon ? words_1.wording.addon : bundleCaption;
return react_1.default.createElement(styled_1.StyledProduct, null, react_1.default.createElement(styled_1.StyledImageLink, {
to: navigationUrl,
target: "_top"
}, react_1.default.createElement(styled_1.StyledImageWithCaption, {
src: image.value,
caption: caption,
captionColor: captionBgColor
})), react_1.default.createElement(styled_1.StyledProductDetails, null, react_1.default.createElement(styled_1.StyledBrandName, {
breedType: "h4",
content: brandName
}), react_1.default.createElement(styled_1.StyledLink, {
to: navigationUrl,
target: "_top"
}, react_1.default.createElement(styled_1.StyledProductName, {
breedType: "h4",
content: name
})), react_1.default.createElement(styled_1.StyledDetailedList, {
list: options
})));
}
exports.defaultRenderCheckoutProduct = defaultRenderCheckoutProduct; //# sourceMappingURL=renderProps.js.map