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:
@@ -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>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user