UNPKG

@shopgate/engage

Version:
6 lines 1.4 kB
import React from'react';import PropTypes from'prop-types';import appConfig from'@shopgate/pwa-common/helpers/config';import{SurroundPortals}from'@shopgate/engage/components';import{PRODUCT_REVIEWS}from'@shopgate/engage/product';import List from"./components/List";import Header from"./components/Header";import AllReviewsLink from"./components/AllReviewsLink";import ReviewsInfo from"./components/ReviewsInfo";import styles from"./style";import connect from"./connector";/** * @param {Object} props The component props. * @param {Object} props.productId The id of the product, the review belongs to. * @param {Array} props.reviews Reviews which should be shown in the product page. * @returns {JSX} */function Reviews(_ref){var productId=_ref.productId,productActive=_ref.productActive,reviews=_ref.reviews;return React.createElement(SurroundPortals,{portalName:PRODUCT_REVIEWS,portalProps:{productId:productId}},appConfig.hasReviews&&productActive&&React.createElement("div",{className:"".concat(styles.container," engage__reviews__reviews"),"data-test-id":"reviewSection"},React.createElement(Header,{productId:productId}),React.createElement(List,{productId:productId,reviews:reviews}),React.createElement(AllReviewsLink,{productId:productId}),React.createElement(ReviewsInfo,null)));}Reviews.defaultProps={productId:null,productActive:true,reviews:null};export default connect(Reviews);