feat: full symptoms filtering system — backend API, megamenu pills, sidebar server-side filter, PDP tags

This commit is contained in:
parsa aghaei committed 2026-07-15 15:03:09 +03:30
1 parent 4676f3a592
commit 6dafe86344
7 files changed
+124 -27

No files matched your search

+24 -12
View File
@@ -154,33 +154,45 @@ export default function Header({
initial={{ opacity: 0, y: 15, scale: 0.98 }}
animate={{ opacity: 1, y: 0, scale: 1 }}
exit={{ opacity: 0, y: 15, scale: 0.98 }}
className="absolute top-[80%] right-0 w-[640px] bg-white border border-medical-gray-100 shadow-2xl rounded-[2.5rem] p-10 grid grid-cols-2 gap-10 z-50 pointer-events-auto"
className="absolute top-[80%] right-0 w-[680px] bg-white border border-medical-gray-100 shadow-2xl rounded-[2.5rem] p-8 grid grid-cols-2 gap-8 z-50 pointer-events-auto"
>
{menuItems.map((item, idx) => (
<div key={idx} className="group/item">
<Link
href={`/shop?category=${item.id}`}
onClick={() => setIsMegaMenuOpen(false)}
className="flex items-center gap-4 mb-4 cursor-pointer block"
className="flex items-center gap-3 mb-4 cursor-pointer block"
>
<div className="p-3 bg-medical-gray-50 rounded-2xl text-canina-blue group-hover/item:bg-canina-blue group-hover/item:text-white transition-all shadow-sm">
<div className="p-2.5 bg-medical-gray-50 rounded-xl text-canina-blue group-hover/item:bg-canina-blue group-hover/item:text-white transition-all shadow-sm">
{item.icon}
</div>
<h4 className="font-black text-medical-gray-900 text-sm font-vazir whitespace-nowrap">{item.title}</h4>
<h4 className="font-black text-medical-gray-900 text-sm font-vazir">{item.title}</h4>
</Link>
<ul className="space-y-2.5 border-r-2 border-medical-gray-50 pr-4">
{item.solutions.map((sol, sIdx) => (
<li key={sIdx}>
{item.solutions.length > 0 ? (
<div className="flex flex-wrap gap-1.5 border-r-2 border-medical-gray-100 pr-3">
{item.solutions.slice(0, 8).map((sol, sIdx) => (
<Link
href={`/shop?category=${item.id}&symptoms=${sol}`}
className="text-[12px] text-medical-gray-400 hover:text-canina-blue hover:translate-x-[-4px] transition-all font-bold cursor-pointer font-vazir whitespace-nowrap block"
key={sIdx}
href={`/shop?category=${item.id}&symptom=${encodeURIComponent(sol)}`}
className="inline-flex items-center px-2.5 py-1 rounded-full text-[10px] font-bold bg-medical-gray-50 border border-medical-gray-200 text-medical-gray-500 hover:bg-canina-blue/5 hover:border-canina-blue/30 hover:text-canina-blue transition-all cursor-pointer font-vazir whitespace-nowrap"
onClick={() => setIsMegaMenuOpen(false)}
>
{sol}
</Link>
</li>
))}
</ul>
))}
{item.solutions.length > 8 && (
<Link
href={`/shop?category=${item.id}`}
className="inline-flex items-center px-2.5 py-1 rounded-full text-[10px] font-bold text-canina-blue hover:underline font-vazir whitespace-nowrap"
onClick={() => setIsMegaMenuOpen(false)}
>
+{item.solutions.length - 8} بیشتر
</Link>
)}
</div>
) : (
<p className="text-[11px] text-medical-gray-400 border-r-2 border-medical-gray-100 pr-3 font-vazir">مشاهده همه محصولات</p>
)}
</div>
))}
</motion.div>