feat(catalog): add breadcrumb, back button, micro-scrollbar and eliminate white gap
This commit is contained in:
1 parent
81b16e4c62
commit
c5d975e0c7
12 files changed
+4945
-4853
No files matched your search
@@ -2,6 +2,7 @@
|
||||
|
||||
import React, { useState, useEffect, useRef, useMemo } from "react";
|
||||
import Image from "next/image";
|
||||
import { useRouter } from "next/navigation";
|
||||
import CatalogPageSpread, { CategoryMeta } from "./CatalogPageSpread";
|
||||
import { Product } from "../../lib/data/products";
|
||||
import { useSettingsStore } from "../../lib/store/settingsStore";
|
||||
@@ -18,7 +19,8 @@ import {
|
||||
ShieldCheck,
|
||||
Zap,
|
||||
Baby,
|
||||
X
|
||||
X,
|
||||
ArrowRight
|
||||
} from "lucide-react";
|
||||
|
||||
interface FlipbookCatalogProps {
|
||||
@@ -36,6 +38,7 @@ const normalizeSearchText = (str: string) => {
|
||||
};
|
||||
|
||||
export default function FlipbookCatalog({ products }: FlipbookCatalogProps) {
|
||||
const router = useRouter();
|
||||
const [currentPage, setCurrentPage] = useState(1);
|
||||
const [searchQuery, setSearchQuery] = useState("");
|
||||
const [isFullscreen, setIsFullscreen] = useState(false);
|
||||
@@ -406,12 +409,35 @@ export default function FlipbookCatalog({ products }: FlipbookCatalogProps) {
|
||||
className={`w-full bg-slate-950 font-vazir text-slate-100 flex flex-col justify-between select-none print:bg-white print:p-0 print:m-0 print:h-auto ${
|
||||
isFullscreen
|
||||
? "h-screen p-3"
|
||||
: "h-[calc(100vh-140px)] min-h-[580px] max-h-[880px] py-2 px-3 sm:px-6"
|
||||
: "min-h-[calc(100vh-64px)] py-3 px-3 sm:px-6"
|
||||
}`}
|
||||
dir="rtl"
|
||||
onTouchStart={handleTouchStart}
|
||||
onTouchEnd={handleTouchEnd}
|
||||
>
|
||||
{/* ========================================================================= */}
|
||||
{/* 0. BREADCRUMB NAVIGATION & BACK BUTTON (Standard across all pages) */}
|
||||
{/* ========================================================================= */}
|
||||
{!isFullscreen && (
|
||||
<div className="max-w-6xl w-full mx-auto flex items-center justify-between pb-3 mb-2 border-b border-slate-800/80 print:hidden gap-2">
|
||||
{/* Breadcrumb path */}
|
||||
<div className="flex items-center gap-1.5 text-xs font-bold text-slate-400 overflow-hidden min-w-0">
|
||||
<span className="cursor-pointer hover:text-amber-400 transition-colors shrink-0" onClick={() => router.push('/')}>خانه</span>
|
||||
<ChevronLeft className="w-3 h-3 text-slate-600 shrink-0" />
|
||||
<span className="text-amber-400 font-black truncate">کاتالوگ آنلاین محصولات</span>
|
||||
</div>
|
||||
|
||||
{/* Integrated Back Button */}
|
||||
<button
|
||||
onClick={() => router.push('/')}
|
||||
className="flex-shrink-0 px-3 py-1 bg-slate-900/90 border border-slate-700/80 rounded-xl text-slate-300 hover:text-white hover:border-amber-400/60 shadow-xs flex items-center gap-1.5 font-bold text-xs transition-all cursor-pointer"
|
||||
>
|
||||
<span>بازگشت</span>
|
||||
<ChevronLeft className="w-3.5 h-3.5" />
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* ========================================================================= */}
|
||||
{/* 1. TOP TOOLBAR (Controls, Search, Print, Fullscreen) - Fixed Height */}
|
||||
{/* ========================================================================= */}
|
||||
@@ -769,8 +795,8 @@ export default function FlipbookCatalog({ products }: FlipbookCatalogProps) {
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{/* Category Jump Pills */}
|
||||
<div className="flex items-center gap-1.5 overflow-x-auto max-w-full py-0.5">
|
||||
{/* Category Jump Pills with Micro Scrollbar */}
|
||||
<div className="flex items-center gap-1.5 overflow-x-auto max-w-full py-1 micro-hscroll select-none touch-pan-x">
|
||||
<button
|
||||
onClick={() => handleJumpToPage(1)}
|
||||
className="px-2 py-1 rounded-lg text-[10px] font-black bg-slate-800 text-white hover:bg-slate-700 transition-all shrink-0 cursor-pointer"
|
||||
|
||||
Reference in new issue
Block a user