loading and catalog card

This commit is contained in:
nabijonovdavronbek619@gmail.com
2026-02-02 18:22:53 +05:00
parent 63b363b142
commit ca3e28779e
9 changed files with 267 additions and 24 deletions

View File

@@ -3,19 +3,35 @@ import { usePathname } from "next/navigation";
import { useEffect, useState } from "react";
import "./page-transition.css";
export default function PageTransition({ children }: { children: React.ReactNode }) {
export default function PageTransition({
children
}: {
children: React.ReactNode
}) {
const pathname = usePathname();
const [displayPath, setDisplayPath] = useState(pathname);
const [isTransitioning, setIsTransitioning] = useState(false);
useEffect(() => {
setIsTransitioning(true);
const timer = setTimeout(() => {
setIsTransitioning(false);
}, 1500); // Animatsiya davomiyligi
if (pathname !== displayPath) {
// Start exit animation
setIsTransitioning(true);
return () => clearTimeout(timer);
}, [pathname]);
const exitTimer = setTimeout(() => {
// Update path (triggers content change)
setDisplayPath(pathname);
// Start enter animation
const enterTimer = setTimeout(() => {
setIsTransitioning(false);
}, 800); // Enter animation duration
return () => clearTimeout(enterTimer);
}, 800); // Exit animation duration
return () => clearTimeout(exitTimer);
}
}, [pathname, displayPath]);
return (
<>
@@ -32,7 +48,6 @@ export default function PageTransition({ children }: { children: React.ReactNode
<stop offset="50%" stopColor="#ff4444" />
<stop offset="100%" stopColor="#ff0000" />
</linearGradient>
<filter id="transition-glow">
<feGaussianBlur stdDeviation="5" result="coloredBlur"/>
<feMerge>
@@ -53,7 +68,7 @@ export default function PageTransition({ children }: { children: React.ReactNode
</g>
</svg>
</div>
{/* Page content */}
<div className={`page-content ${isTransitioning ? "transitioning" : ""}`}>
{children}