import { useEffect, useRef, useState } from "react";
import { motion, AnimatePresence } from "framer-motion";
import { Menu, ShoppingCart, X, ChevronLeft, ChevronRight } from "lucide-react";
export default function ChicoPetShop() {
const [cartCount, setCartCount] = useState(0);
const [selectedProduct, setSelectedProduct] = useState(null);
const [currentImgIndex, setCurrentImgIndex] = useState(0);
const audioRef = useRef(null);
// 🐾 Trail paw effect
useEffect(() => {
const trail = document.createElement("div");
trail.className = "fixed top-0 left-0 pointer-events-none z-50";
document.body.appendChild(trail);
const move = (e) => {
const paw = document.createElement("div");
paw.innerHTML = "🐾";
paw.className =
"absolute text-2xl opacity-70 animate-bounce pointer-events-none";
paw.style.left = e.pageX + "px";
paw.style.top = e.pageY + "px";
trail.appendChild(paw);
setTimeout(() => paw.remove(), 800);
};
window.addEventListener("mousemove", move);
return () => window.removeEventListener("mousemove", move);
}, []);
const sections = [
{
title: "مقالهها",
items: ["🐶 درباره سگ", "🐱 درباره گربه", "🍖 درباره غذا"],
},
{
title: "غذا",
items: ["🍗 غذای مخصوص سگ", "🥩 غذای مخصوص گربه", "🥨 غذای خشک"],
},
{ title: "آرایش و بهداشتی", items: [] },
{ title: "کلینیک و درمان", items: [] },
];
// 🦴🐟 شناورهای پسزمینه
const floatingItems = ["🦴", "🐟", "🦴", "🐟", "🦴"];
// 🎵 پخش صدا
const playSound = () => {
if (audioRef.current) {
audioRef.current.currentTime = 0;
audioRef.current.play();
}
};
// 📦 محصولات نمونه (چند عکس برای هر محصول)
const products = [
{
id: 1,
name: "غذای خشک سگ",
price: "250,000 تومان",
images: [
"https://place-puppy.com/300x200",
"https://place-puppy.com/301x200",
"https://place-puppy.com/302x200",
],
desc: "غذای کامل و مغذی برای سگهای بالغ با پروتئین بالا.",
},
{
id: 2,
name: "غذای خشک گربه",
price: "220,000 تومان",
images: [
"https://placekitten.com/300/200",
"https://placekitten.com/301/200",
"https://placekitten.com/302/200",
],
desc: "مخصوص گربههای خانگی، تقویت پوست و مو.",
},
{
id: 3,
name: "شامپو سگ",
price: "180,000 تومان",
images: [
"https://placebear.com/300/200",
"https://placebear.com/301/200",
],
desc: "شامپوی ملایم و ضدحساسیت برای پوست سگ.",
},
];
// وقتی محصول باز شد، عکس اول نمایش داده میشه
const openProduct = (product) => {
setSelectedProduct(product);
setCurrentImgIndex(0);
};
// وقتی محصول باز شد، عکس اول نمایش داده میشه
const openProduct = (product) => {
setSelectedProduct(product);
setCurrentImgIndex(0);
};
return (
{/* 🔵 استخوان و ماهی شناور */}
{floatingItems.map((icon, i) => (
{icon}
))}
import { useEffect, useRef, useState } from "react";
import { motion, AnimatePresence } from "framer-motion";
import { Menu, ShoppingCart, X, ChevronLeft, ChevronRight } from "lucide-react";
export default function ChicoPetShop() {
const [cartCount, setCartCount] = useState(0);
const [selectedProduct, setSelectedProduct] = useState(null);
const [currentImgIndex, setCurrentImgIndex] = useState(0);
const audioRef = useRef(null);
𝒜𝓃𝒾𝓉𝒶🤍, [9/10/2025 11:06 AM]
// 🐾 Trail paw effect
useEffect(() => {
const trail = document.createElement("div");
trail.className = "fixed top-0 left-0 pointer-events-none z-50";
document.body.appendChild(trail);
const move = (e) => {
const paw = document.createElement("div");
paw.innerHTML = "🐾";
paw.className =
"absolute text-2xl opacity-70 animate-bounce pointer-events-none";
paw.style.left = e.pageX + "px";
paw.style.top = e.pageY + "px";
trail.appendChild(paw);
setTimeout(() => paw.remove(), 800);
};
window.addEventListener("mousemove", move);
return () => window.removeEventListener("mousemove", move);
}, []);
const sections = [
{
title: "مقالهها",
items: ["🐶 درباره سگ", "🐱 درباره گربه", "🍖 درباره غذا"],
},
{
title: "غذا",
items: ["🍗 غذای مخصوص سگ", "🥩 غذای مخصوص گربه", "🥨 غذای خشک"],
},
{ title: "آرایش و بهداشتی", items: [] },
{ title: "کلینیک و درمان", items: [] },
];
// 🦴🐟 شناورهای پسزمینه
const floatingItems = ["🦴", "🐟", "🦴", "🐟", "🦴"];
// 🎵 پخش صدا
const playSound = () => {
if (audioRef.current) {
audioRef.current.currentTime = 0;
audioRef.current.play();
}
};
// 📦 محصولات نمونه (چند عکس برای هر محصول)
const products = [
{
id: 1,
name: "غذای خشک سگ",
price: "250,000 تومان",
images: [
"https://place-puppy.com/300x200",
"https://place-puppy.com/301x200",
"https://place-puppy.com/302x200",
],
desc: "غذای کامل و مغذی برای سگهای بالغ با پروتئین بالا.",
},
{
id: 2,
name: "غذای خشک گربه",
price: "220,000 تومان",
images: [
"https://placekitten.com/300/200",
"https://placekitten.com/301/200",
"https://placekitten.com/302/200",
],
desc: "مخصوص گربههای خانگی، تقویت پوست و مو.",
},
{
id: 3,
name: "شامپو سگ",
price: "180,000 تومان",
images: [
"https://placebear.com/300/200",
"https://placebear.com/301/200",
],
desc: "شامپوی ملایم و ضدحساسیت برای پوست سگ.",
},
];
// وقتی محصول باز شد، عکس اول نمایش داده میشه
const openProduct = (product) => {
setSelectedProduct(product);
setCurrentImgIndex(0);
};
return (
{/* 🔵 استخوان و ماهی شناور */}
{floatingItems.map((icon, i) => (
{icon}
))}
{/* 🔝 نوار بالا */}
{/* 📂 منوی سمت چپ بالا */}
𝒜𝓃𝒾𝓉𝒶🤍, [9/10/2025 11:06 AM]
{
setCartCount(cartCount + 1);
playSound();
}}
className="flex items-center gap-2 bg-white text-[#8b5e3c] px-3 py-2 rounded-xl shadow cursor-pointer"
>
سبد خرید ({cartCount})
{/* 📝 بخشها */}
{sections.map((section, idx) => (
{section.title}
{section.items.map((item, i) => (
{item}
))}
))}
{/* 🛍️ بخش محصولات */}
محصولات
{products.map((product) => (
openProduct(product)}
>
{product.name}
{product.price}
))}
{/* 🪟 مودال جزئیات محصول */}
{selectedProduct && (
setSelectedProduct(null)}
>
e.stopPropagation()}
>
{/* ❌ بستن */}
{/* 📸 اسلایدر عکسها */}

{/* ◀️ قبلی */}
{/* ▶️ بعدی */}
{selectedProduct.name}
{selectedProduct.desc}
{selectedProduct.price}
{
setCartCount(cartCount + 1);
playSound();
}}
className="w-full bg-[#8b5e3c] text-white py-2 rounded-xl shadow"
>
🛒 افزودن به سبد
)}
{/* 🎵 صدا */}
);
}