last updates: add product page
This commit is contained in:
@@ -2,9 +2,9 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import EmptyState from "./emptyData";
|
||||
import { GET } from "@/lib/allProducts";
|
||||
import { ProductModal } from "../ProductModal";
|
||||
import { ProductModal } from "../productSection/ProductModal";
|
||||
import { motion } from "framer-motion";
|
||||
import { ProductCard } from "../ProductCard";
|
||||
import { ProductCard } from "../productSection/ProductCard";
|
||||
|
||||
const itemVariants = {
|
||||
hidden: { opacity: 0, y: 20 },
|
||||
@@ -14,13 +14,13 @@ const itemVariants = {
|
||||
export default function Products() {
|
||||
const [allProducts, setAllProducts] = useState<any>(null);
|
||||
const [selectedProduct, setSelectedProduct] = useState<any>(null);
|
||||
const all = GET();
|
||||
useEffect(() => {
|
||||
const all = GET();
|
||||
all && Array.isArray(all) && all.length > 0
|
||||
? setAllProducts(all)
|
||||
: setAllProducts([]);
|
||||
setAllProducts;
|
||||
}, []);
|
||||
}, [all]);
|
||||
const handleViewDetails = (slug: string) => {
|
||||
const product = allProducts.find((p: any) => p.slug === slug);
|
||||
if (product) {
|
||||
|
||||
Reference in New Issue
Block a user