Repository URL to install this package:
|
Version:
0.9.5 ▾
|
ui-component-library
/
dist
/
components
/
presets
/
CollectionProduct
/
PdpCollection
/
PdpCollectionThemed.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 ProductItem_1 = require("presets/BundleCollection/ProductItem");
const ProductList_1 = require("presets/BundleCollection/ProductList");
const createItemRenderProps = data => {
const renderRating = (props) => {
return 'I am the renderProp to override defaultRenderRating()';
};
const handleWriteReview = args => {
console.log('[Handler] handleWriteReview', args);
};
const handlePrimaryButton = args => {
console.log('[Handler] handlePrimaryButton', args);
};
const handleSecondaryButton = args => {
console.log('[Handler] handleSecondaryButton', args);
};
const handleCheckboxInputChange = args => {
console.log('[Handler] handleCheckboxInputChange', args);
};
const handleQuantityInputChange = args => {
console.log('[Handler] handleQuantityInputChange', args);
};
return {
renderRating,
//
handleWriteReview,
handlePrimaryButton,
handleSecondaryButton,
handleCheckboxInputChange,
handleQuantityInputChange,
};
};
const createListRenderProps = data => {
const renderItem = (props) => {
const { item, index } = props;
const { renderRating,
//
handleWriteReview, handlePrimaryButton, handleSecondaryButton, handleCheckboxInputChange, handleQuantityInputChange, } = createItemRenderProps(item);
const attributes = {
renderRating,
//
handleWriteReview,
handlePrimaryButton,
handleSecondaryButton,
handleCheckboxInputChange,
handleQuantityInputChange,
};
return (react_1.default.createElement(ProductItem_1.ProductItem, Object.assign({ key: index, item: item, index: index, onWriteReviewClick: handleWriteReview, onPrimaryButtonClick: handlePrimaryButton, onSecondaryButtonClick: handleSecondaryButton, onCheckBoxInputChange: handleCheckboxInputChange, onQuantityInputChange: handleQuantityInputChange }, attributes)));
};
return {
renderItem,
};
};
class PdpCollectionThemed extends react_1.default.Component {
render() {
const { renderItem } = createListRenderProps(this.props);
const attributes = Object.assign({ renderItem }, this.props);
return react_1.default.createElement(ProductList_1.ProductList, Object.assign({}, attributes));
}
}
exports.PdpCollectionThemed = PdpCollectionThemed;
exports.default = PdpCollectionThemed;
//# sourceMappingURL=PdpCollectionThemed.js.map