diff --git a/src/components/Layout/PageTitle.component.tsx b/src/components/Layout/PageTitle.component.tsx index 3c849e6cf..d3d524f6d 100644 --- a/src/components/Layout/PageTitle.component.tsx +++ b/src/components/Layout/PageTitle.component.tsx @@ -13,7 +13,7 @@ interface IPageTitleProps { const PageTitle = ({ title, marginLeft }: IPageTitleProps) => (
diff --git a/src/components/Product/AddToCart.component.tsx b/src/components/Product/AddToCart.component.tsx index 2413cd294..67b8dbca6 100644 --- a/src/components/Product/AddToCart.component.tsx +++ b/src/components/Product/AddToCart.component.tsx @@ -80,15 +80,18 @@ export interface IProduct { export interface IProductRootObject { product: IProduct; variationId?: number; + fullWidth?: boolean; } /** * Handles the Add to cart functionality. * Uses GraphQL for product data * @param {IAddToCartProps} product // Product data + * @param {number} variationId // Variation ID + * @param {boolean} fullWidth // Whether the button should be full-width */ -const AddToCart = ({ product, variationId }: IProductRootObject) => { +const AddToCart = ({ product, variationId, fullWidth = false }: IProductRootObject) => { const { setCart } = useContext(CartContext); const [requestError, setRequestError] = useState(false); @@ -146,6 +149,7 @@ const AddToCart = ({ product, variationId }: IProductRootObject) => { diff --git a/src/components/Product/SingleProduct.component.tsx b/src/components/Product/SingleProduct.component.tsx index e7b91f820..d8c26c1d2 100644 --- a/src/components/Product/SingleProduct.component.tsx +++ b/src/components/Product/SingleProduct.component.tsx @@ -57,7 +57,7 @@ const SingleProduct = ({ product }: IProductRootObject) => { ) : ( -
+
{image && ( { className="h-auto p-8 transition duration-500 ease-in-out transform xl:p-2 md:p-2 lg:p-2 md:hover:grow md:hover:shadow-lg md:hover:scale-105" /> )} -
-

{name}

-
+
+

+ {name} +

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

+

+

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

-

+

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

@@ -96,27 +97,25 @@ const SingleProduct = ({ product }: IProductRootObject) => { )} {/* Display regular price when not on sale */} {!onSale && ( -

{price}

+

{price}

)} -
-

- {DESCRIPTION_WITHOUT_HTML} -

+

{DESCRIPTION_WITHOUT_HTML}

{Boolean(product.stockQuantity) && ( -

- {product.stockQuantity} på lager -

+
+

+ {product.stockQuantity} på lager +

+
)} {product.variations && ( -

- Varianter +

+ -

+
)} -
- { - // Display default AddToCart button if we do not have variations. - // If we do, send the variationId to AddToCart button - } +
{product.variations && ( )} - {!product.variations && } + {!product.variations && }
diff --git a/src/components/UI/Button.component.tsx b/src/components/UI/Button.component.tsx index ec4a6d93c..2883d8c34 100644 --- a/src/components/UI/Button.component.tsx +++ b/src/components/UI/Button.component.tsx @@ -7,15 +7,17 @@ interface IButtonProps { buttonDisabled?: boolean; color?: TButtonColors; children: ReactNode; + fullWidth?: boolean; } /** * Renders a clickable button - * @function PageTitle + * @function Button * @param {void} handleButtonClick - Handle button click * @param {boolean?} buttonDisabled - Is button disabled? - * @param {color?} TButtonColors - Color for button, either red or blue + * @param {TButtonColors?} color - Color for button, either red or blue * @param {ReactNode} children - Children for button + * @param {boolean?} fullWidth - Whether the button should be full-width on mobile * @returns {JSX.Element} - Rendered component */ const Button = ({ @@ -23,6 +25,7 @@ const Button = ({ buttonDisabled, color = 'blue', children, + fullWidth = false, }: IButtonProps) => (