perf: optimize framer-motion bundle size and memoize dictionary fetching

- Wrap getDictionary with React cache to prevent redundant JSON parsing on the server
- Create MotionProvider to globally initialize framer-motion LazyMotion with domAnimation
- Replace standard 'motion' imports with 'm' across all animated client components (HomeClient, Navbar, GaleriClient, SSSClient, card, text-reveal) to drastically reduce First Load JS size
This commit is contained in:
mstfyldz
2026-06-04 12:50:23 +03:00
parent e1d8bae5a4
commit acf01c81fa
9 changed files with 59 additions and 44 deletions
+3 -3
View File
@@ -1,6 +1,6 @@
"use client";
import { motion, useInView } from "framer-motion";
import { m, useInView } from "framer-motion";
import { useRef } from "react";
import { cn } from "@/lib/utils";
@@ -26,7 +26,7 @@ export function TextReveal({
return (
<span ref={ref} className={cn("inline", className)}>
{words.map((word, i) => (
<motion.span
<m.span
key={i}
className="inline-block mr-[0.28em] last:mr-0"
initial={{ opacity: 0, y: 22, filter: "blur(4px)" }}
@@ -42,7 +42,7 @@ export function TextReveal({
}}
>
{word}
</motion.span>
</m.span>
))}
</span>
);