UNPKG

@shopgate/engage

Version:
49 lines (48 loc) 1.59 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} */ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; function Reviews({ productId, productActive, reviews }) { return /*#__PURE__*/_jsx(SurroundPortals, { portalName: PRODUCT_REVIEWS, portalProps: { productId }, children: appConfig.hasReviews && productActive && /*#__PURE__*/_jsxs("div", { className: `${styles.container} engage__reviews__reviews`, "data-test-id": "reviewSection", children: [/*#__PURE__*/_jsx(Header, { productId: productId }), /*#__PURE__*/_jsx(List, { productId: productId, reviews: reviews }), /*#__PURE__*/_jsx(AllReviewsLink, { productId: productId }), /*#__PURE__*/_jsx(ReviewsInfo, {})] }) }); } Reviews.defaultProps = { productId: null, productActive: true, reviews: null }; export default connect(Reviews);