Repository URL to install this package:
|
Version:
2.8.4 ▾
|
@skava/ui
/
dist
/
components
/
presets
/
CollectionProduct
/
PdpCollection
/
PdpCollectionThemed.js
|
|---|
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
const tslib_1 = require("tslib");
const react_1 = tslib_1.__importDefault(require("react"));
const ProductItem_1 = require("../../BundleCollection/ProductItem");
const ProductList_1 = require("../../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