From 429b66b0f576e5c3b182f146c8a05fe1009425d4 Mon Sep 17 00:00:00 2001
From: Yuvaraj2111 <64225422+Yuvaraj2111@users.noreply.github.com>
Date: Tue, 20 Jul 2021 16:27:41 +0530
Subject: [PATCH] overlay added
---
.../pages/Category/Components/procard.jsx | 226 +++++++++---------
.../pages/Category/Components/viewproduct.jsx | 68 +++---
.../pages/offer-page/components/Layout.jsx | 83 ++++++-
src/components/pages/wishList/index.jsx | 124 +++++-----
src/components/utils/footer/index.jsx | 21 +-
src/styles/pages/offer-page.js | 27 +++
6 files changed, 324 insertions(+), 225 deletions(-)
diff --git a/src/components/pages/Category/Components/procard.jsx b/src/components/pages/Category/Components/procard.jsx
index 7431002..548b459 100644
--- a/src/components/pages/Category/Components/procard.jsx
+++ b/src/components/pages/Category/Components/procard.jsx
@@ -1,4 +1,4 @@
-import React,{ useState,useEffect } from "react";
+import React, { useState, useEffect } from "react";
import { FiHeart } from "react-icons/fi";
import { FaHeart } from "react-icons/fa";
import { AiOutlineShoppingCart } from "react-icons/ai";
@@ -36,84 +36,84 @@ const Card1 = () => {
const [loading, setloading] = useState(true);
// const [toggleHeart, setToggleHeart] = useState(false);
- async function fetchCategory(cat){
- let pro=[];
- pro = await fetchResult("productcategory",cat)
+ async function fetchCategory(cat) {
+ let pro = [];
+ pro = await fetchResult("productcategory", cat)
setproductData(pro)
setloading(false);
- console.log("product",productData)
- console.log("casga",cat)
- }
- async function fetchsubCategory(subcat){
- let pro=[];
- pro = await fetchResult("productsubcategory",subcat)
+ console.log("product", productData)
+ console.log("casga", cat)
+ }
+ async function fetchsubCategory(subcat) {
+ let pro = [];
+ pro = await fetchResult("productsubcategory", subcat)
setproductData(pro)
setloading(false);
- console.log("product",productData)
- console.log("casga",subcat)
- }
+ console.log("product", productData)
+ console.log("casga", subcat)
+ }
const params = useParams();
- console.log("paramsslug",params.slug);
- console.log("paramssubslug",params.subslug);
+ console.log("paramsslug", params.slug);
+ console.log("paramssubslug", params.subslug);
useEffect(() => {
// Fetch single product here
- if(params.subslug === undefined || params.subslug==='All')
+ if (params.subslug === undefined || params.subslug === 'All')
fetchCategory(params.slug)
else
fetchsubCategory(params.subslug)
- }, [params.slug,params.subslug]);
- const updatewish = async (id,wish) => {
- let item=productData;
- console.log("wishid",id);
- console.log("wishstatus",wish)
- let wishlistproduct=[];
- if(wish){
- wishlistproduct = await fetchResult("removefromwishlist",id)
- console.log("wishlistproduct",wishlistproduct)
- if(wishlistproduct.description.includes("doesn't")){
- toast("Already removed from Wishlist!",{
- style:{backgroundColor:`${LightShade}`,color:'white',width:'60%'}
+ }, [params.slug, params.subslug]);
+ const updatewish = async (id, wish) => {
+ let item = productData;
+ console.log("wishid", id);
+ console.log("wishstatus", wish)
+ let wishlistproduct = [];
+ if (wish) {
+ wishlistproduct = await fetchResult("removefromwishlist", id)
+ console.log("wishlistproduct", wishlistproduct)
+ if (wishlistproduct.description.includes("doesn't")) {
+ toast("Already removed from Wishlist!", {
+ style: { backgroundColor: `${LightShade}`, color: 'white', width: '60%' }
});
}
- else if(wishlistproduct.description.includes("successfully")){
- toast("Removed from Wishlist!",{
- style:{backgroundColor:'plum',color:'white',width:'50%'}
+ else if (wishlistproduct.description.includes("successfully")) {
+ toast("Removed from Wishlist!", {
+ style: { backgroundColor: 'plum', color: 'white', width: '50%' }
});
- let a=item.find(e => e.id === id)
+ let a = item.find(e => e.id === id)
a.wishlist = !a.wishlist;
- console.log("uytdfgh",item)
+ console.log("uytdfgh", item)
setproductData([...item])
}
- else{
- toast.error("Error in Removing from Wishlist",{
- style:{backgroundColor:'plum',color:'white',width:'50%'}
+ else {
+ toast.error("Error in Removing from Wishlist", {
+ style: { backgroundColor: 'plum', color: 'white', width: '50%' }
});
}
}
- else{
- wishlistproduct = await fetchResult("addtowishlist",id)
- console.log("wishlistproduct",wishlistproduct)
- if(wishlistproduct.description.includes("Already")){
- toast("Already in Wishlist!",{
- style:{backgroundColor:`${LightShade}`,color:'white',width:'60%'}
+ else {
+ wishlistproduct = await fetchResult("addtowishlist", id)
+ console.log("wishlistproduct", wishlistproduct)
+ if (wishlistproduct.description.includes("Already")) {
+ toast("Already in Wishlist!", {
+ style: { backgroundColor: `${LightShade}`, color: 'white', width: '60%' }
});
}
- else if(wishlistproduct.description.includes("created")){
- toast("Added To Wishlist!",{
- style:{backgroundColor:'plum',color:'white',width:'50%'}
+ else if (wishlistproduct.description.includes("created")) {
+ toast("Added To Wishlist!", {
+ style: { backgroundColor: 'plum', color: 'white', width: '50%' }
});
- let a=item.find(e => e.id === id)
+ let a = item.find(e => e.id === id)
a.wishlist = !a.wishlist;
- console.log("uytdfgh",item)
+ console.log("uytdfgh", item)
setproductData([...item])
}
- else{
- toast.error("Error in Adding to Wishlist",{
- style:{backgroundColor:'plum',color:'white',width:'50%'}
+ else {
+ toast.error("Error in Adding to Wishlist", {
+ style: { backgroundColor: 'plum', color: 'white', width: '50%' }
});
}
}
-
+
}
const ShopbyPrice = () => (
@@ -268,68 +268,68 @@ const Card1 = () => {
);
return (
<>
-
{product.name}
+ + ₹{product.buyingPrice} +In stock
+ : +Out of stock
+ } +{product.name}
- - ₹{product.buyingPrice} -In stock
- : -Out of stock
- } -