diff --git a/src/components/Product/SingleProduct.component.tsx b/src/components/Product/SingleProduct.component.tsx index 481deb30c..c9c063f45 100644 --- a/src/components/Product/SingleProduct.component.tsx +++ b/src/components/Product/SingleProduct.component.tsx @@ -1,4 +1,3 @@ -/*eslint complexity: ["error", 20]*/ // Imports import { useState, useEffect } from 'react'; @@ -43,13 +42,12 @@ const SingleProduct = ({ product }: IProductRootObject) => { if (process.browser) { DESCRIPTION_WITHOUT_HTML = new DOMParser().parseFromString( description, - 'text/html', + 'text/html' ).body.textContent; } return (
- {/* Show loading spinner while loading, and hide content while loading */} {isLoading ? (

Laster produkt ...

@@ -57,95 +55,99 @@ const SingleProduct = ({ product }: IProductRootObject) => {
) : ( -
-
- {image && ( - {name} - )} - {!image && ( +
+
+ {/* Image Container */} +
{name} - )} -
+
+ + {/* Product Details Container */} +

{name}

- {/* Display sale price when on sale */} - {onSale && ( -
-

- {product.variations && filteredVariantPrice(price, '')} - {!product.variations && salePrice} -

-

- {product.variations && filteredVariantPrice(price, 'right')} - {!product.variations && regularPrice} -

-
- )} - {/* Display regular price when not on sale */} - {!onSale &&

{price}

} -

+ + {/* Price Display */} +

+ {onSale ? ( +
+

+ {product.variations + ? filteredVariantPrice(price, '') + : salePrice} +

+

+ {product.variations + ? filteredVariantPrice(price, 'right') + : regularPrice} +

+
+ ) : ( +

{price}

+ )} +
+ + {/* Description */} +

{DESCRIPTION_WITHOUT_HTML}

+ + {/* Stock Status */} {Boolean(product.stockQuantity) && ( -
-

- {product.stockQuantity} på lager -

+
+
+

+ {product.stockQuantity} på lager +

+
)} + + {/* Variations Select */} {product.variations && ( -
+
)} -
- {product.variations && ( + + {/* Add to Cart Button */} +
+ {product.variations ? ( - )} - {!product.variations && ( + ) : ( )}