From 0a2e46bfae5deb3df99fe883b11835db09085c68 Mon Sep 17 00:00:00 2001 From: Marina Avramenko Date: Sun, 10 Nov 2024 17:42:02 +0200 Subject: [PATCH] add task solution --- .../ItemInformation/ItemInformation.tsx | 22 +++++++++---------- src/components/ItemsProduct/ItemsProduct.tsx | 6 ++--- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/src/components/ItemInformation/ItemInformation.tsx b/src/components/ItemInformation/ItemInformation.tsx index 19373d15cf..89ddc13cd6 100644 --- a/src/components/ItemInformation/ItemInformation.tsx +++ b/src/components/ItemInformation/ItemInformation.tsx @@ -98,17 +98,15 @@ export const ItemInformation = () => { return str[0].toUpperCase() + str.slice(1); } - const BASE_URL = 'https://avramenkomarina.github.io/react_phone-catalog'; - return (
- home + home - home + home

{ucFirst(currentProduct?.category)}

- home + home

{currentProduct?.name}

@@ -116,7 +114,7 @@ export const ItemInformation = () => { to={`../img/${currentProduct?.category}`} className={styles.itemInformation_buttonBack} > - back + back

Back

{currentProduct?.name}

@@ -137,7 +135,7 @@ export const ItemInformation = () => { onClick={() => { isClickedOnImage(image); }} - src={`${BASE_URL}/${image}`} + src={`./${image}`} alt="img" />
@@ -146,7 +144,7 @@ export const ItemInformation = () => { {/** */}
- image + image
{/* on phone */} @@ -164,7 +162,7 @@ export const ItemInformation = () => { onClick={() => { isClickedOnImage(image); }} - src={`${BASE_URL}/${currentImage}`} + src={`./${currentImage}`} alt="img" style={{ border: currentImage === image ? '1px solid #313237' : '', @@ -267,11 +265,11 @@ export const ItemInformation = () => { > {isClickedOnFavourite ? ( ) : ( - + )} diff --git a/src/components/ItemsProduct/ItemsProduct.tsx b/src/components/ItemsProduct/ItemsProduct.tsx index 4cc13dfbe8..3938776f78 100644 --- a/src/components/ItemsProduct/ItemsProduct.tsx +++ b/src/components/ItemsProduct/ItemsProduct.tsx @@ -35,8 +35,6 @@ export const ItemsProduct: React.FC = ({ product, discount }) => { } }; - const BASE_URL = 'https://avramenkomarina.github.io/react_phone-catalog'; - return (
= ({ product, discount }) => { className={styles.product_image_img} src={ product.images - ? `${BASE_URL}/img/${product.images[0]}` - : `${BASE_URL}/img/${product.image}` + ? `./img/${product.images[0]}` + : `./img/${product.image}` } alt="image/product" />