last updates: add product page

This commit is contained in:
nabijonovdavronbek619@gmail.com
2025-12-24 12:00:04 +05:00
parent 52945dc5d8
commit de12e23af1
6 changed files with 13 additions and 10 deletions

View File

@@ -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) {