All files / src/components/ProductDetails ProductDetailsPage.jsx

100% Statements 3/3
100% Branches 2/2
100% Functions 3/3
100% Lines 3/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29                    5x     30x   3x                          
/* eslint-disable max-len */
/* eslint-disable react/no-array-index-key */
/* eslint-disable react/prop-types */
import React from 'react';
import ProductDetails from './ProductDetails';
import ProductImages from './ProductImages';
import SimilarProducts from '../SimilarProducts/SimilarProducts';
import '../../helpers/spinner/spinner.scss';
 
function ProductDetailsPage({ categoryResult, match }) {
  return (
    <>
      {categoryResult.groups
        ? categoryResult.groups.filter((item) => item.id === match.params.id)
          .map((product, index) => (
            <React.Fragment key={index}>
              <div className="grid-x grid-padding-x small-up-1 medium-up-2 large-up-2">
                <ProductImages product={product} />
                <ProductDetails product={product} />
              </div>
              <SimilarProducts categoryResult={categoryResult} />
            </React.Fragment>
          )) : <div className="loading-spinner pdp-page" />}
    </>
  );
}
 
export default ProductDetailsPage;