Skip to content

Commit

Permalink
chore:fixed rendering issue
Browse files Browse the repository at this point in the history
  • Loading branch information
BuyankhuuTsCAl committed Nov 14, 2023
1 parent 1d0fa4e commit 46341fd
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/app/[productId]/Buttons.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useState } from 'react';
import { ToastContainer, toast } from 'react-toastify';
import { toast } from 'react-toastify';
import {
ButtonsWrapper,
AddToCartButton,
Expand Down
1 change: 1 addition & 0 deletions src/app/[productId]/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export const AddToCartButton = styled.button`

export const ToastPopUP = styled(ToastContainer)`
position: fixed;
z-index: 100;
transform: translatey(130px);
`;
1 change: 1 addition & 0 deletions src/app/profileScreen/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export const LogOutButton = styled.button`

export const PopUp = styled(ToastContainer)`
transform: translate(-150px, 250px);
position: fixed;
`;

export const FavoriteDiv = styled.div`
Expand Down
14 changes: 5 additions & 9 deletions src/app/storefront/IndividualItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,14 @@ export default function IndividualItem(props: { product: Product }) {
const [isFavorite, setIsFavorite] = useState(true);
const router = useRouter();

async function fetchProducts() {
const data = (await arrayOfFavorites()) as Product[];
for (let i = 0; i < data.length; i += 1) {
const ithProduct = data[i];
useEffect(() => {
async function fetchProducts() {
const data = (await arrayOfFavorites()) as Product[];

if (product.product_id === ithProduct.product_id) {
setIsFavorite(!isFavorite);
if (data.find(item => item.product_id === product.product_id)) {
setIsFavorite(false);
}
}
}

useEffect(() => {
fetchProducts();
});

Expand Down

0 comments on commit 46341fd

Please sign in to comment.