Skip to content

Commit

Permalink
add task solution
Browse files Browse the repository at this point in the history
  • Loading branch information
AvramenkoMarina committed Nov 10, 2024
1 parent d051052 commit 0a2e46b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 16 deletions.
22 changes: 10 additions & 12 deletions src/components/ItemInformation/ItemInformation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,25 +98,23 @@ export const ItemInformation = () => {
return str[0].toUpperCase() + str.slice(1);
}

const BASE_URL = 'https://avramenkomarina.github.io/react_phone-catalog';

return (
<div className={styles.itemInformation}>
<div className={styles.itemInformation_route}>
<Link to={'/'}>
<img src={`${BASE_URL}/img/icons/Home.svg`} alt="home" />
<img src={`./img/icons/Home.svg`} alt="home" />
</Link>
<img src={`${BASE_URL}/img/icons/Chevron-right-dis.svg`} alt="home" />
<img src={`./img/icons/Chevron-right-dis.svg`} alt="home" />
<h3>{ucFirst(currentProduct?.category)}</h3>
<img src={`${BASE_URL}/img/icons/Chevron-right-dis.svg`} alt="home" />
<img src={`./img/icons/Chevron-right-dis.svg`} alt="home" />
<p>{currentProduct?.name}</p>
</div>

<Link
to={`../img/${currentProduct?.category}`}
className={styles.itemInformation_buttonBack}
>
<img src={`${BASE_URL}/img/icons/Chevron-left.svg`} alt="back" />
<img src={`./img/icons/Chevron-left.svg`} alt="back" />
<p>Back</p>
</Link>
<h2 className={styles.itemInformation_title}>{currentProduct?.name}</h2>
Expand All @@ -137,7 +135,7 @@ export const ItemInformation = () => {
onClick={() => {
isClickedOnImage(image);
}}
src={`${BASE_URL}/${image}`}
src={`./${image}`}
alt="img"
/>
</div>
Expand All @@ -146,7 +144,7 @@ export const ItemInformation = () => {
{/** */}

<div className={styles.itemInformation_generalInfo_mainImage}>
<img src={`${BASE_URL}/${currentImage}`} alt="image" />
<img src={`./${currentImage}`} alt="image" />
</div>

{/* on phone */}
Expand All @@ -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' : '',
Expand Down Expand Up @@ -267,11 +265,11 @@ export const ItemInformation = () => {
>
{isClickedOnFavourite ? (
<img
src={`${BASE_URL}/img/icons/FavouritesFilledHeart.svg`}
alt=""
src={`./img/icons/FavouritesFilledHeart.svg`}
alt="img"
/>
) : (
<img src={`${BASE_URL}/img/icons/favourites.svg`} alt="" />
<img src={`./img/icons/favourites.svg`} alt="" />
)}
</div>
</div>
Expand Down
6 changes: 2 additions & 4 deletions src/components/ItemsProduct/ItemsProduct.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ export const ItemsProduct: React.FC<Props> = ({ product, discount }) => {
}
};

const BASE_URL = 'https://avramenkomarina.github.io/react_phone-catalog';

return (
<div className={styles.product}>
<Link
Expand All @@ -49,8 +47,8 @@ export const ItemsProduct: React.FC<Props> = ({ 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"
/>
Expand Down

0 comments on commit 0a2e46b

Please sign in to comment.