Repository URL to install this package:
Version:
0.9.7 ▾
|
ui-component-library
/
dist
/
components
/
presets
/
BundleProduct
/
CheckoutCartBundle
/
ProductItem
/
renderProps.js
|
---|
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const react_1 = __importDefault(require("react"));
const exotic_1 = require("exotic");
const module_1 = require();
';
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 = module_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 } = item;
const captionBgColor = isBundleSubProduct && hasAddon ? '#EA7B0A' : '#195FBF';
const bundleCaption = `${module_1.wording.item} ${index + 1} of ${productCount}`;
const caption = isBundleSubProduct && hasAddon ? module_1.wording.addon : bundleCaption;
return (react_1.default.createElement(styled_1.StyledProduct, null,
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.StyledProductName, { breedType: "h4", content: name }),
react_1.default.createElement(styled_1.StyledDetailedList, { list: options }))));
}
exports.defaultRenderCheckoutProduct = defaultRenderCheckoutProduct;
//# sourceMappingURL=renderProps.js.map