feat(ui): add staggered entry animations using framer-motion and fix typography nesting

This commit is contained in:
Poyraz Avsever
2026-03-30 11:30:12 +03:00
parent a23665ee9e
commit 87f6585a78
5 changed files with 170 additions and 95 deletions
+64
View File
@@ -0,0 +1,64 @@
"use client";
import { motion } from "framer-motion";
import type { ReactNode } from "react";
type FadeInProps = {
children: ReactNode;
className?: string;
delay?: number;
};
export function FadeIn({ children, className, delay = 0 }: FadeInProps) {
return (
<motion.div
initial={{ opacity: 0, y: 12 }}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: 0.35, delay, ease: "easeOut" }}
className={className}
>
{children}
</motion.div>
);
}
type StaggerContainerProps = {
children: ReactNode;
className?: string;
stagger?: number;
};
export function StaggerContainer({ children, className, stagger = 0.06 }: StaggerContainerProps) {
return (
<motion.div
initial="hidden"
animate="visible"
variants={{
hidden: {},
visible: { transition: { staggerChildren: stagger } },
}}
className={className}
>
{children}
</motion.div>
);
}
type StaggerItemProps = {
children: ReactNode;
className?: string;
};
export function StaggerItem({ children, className }: StaggerItemProps) {
return (
<motion.div
variants={{
hidden: { opacity: 0, y: 12 },
visible: { opacity: 1, y: 0, transition: { duration: 0.35, ease: "easeOut" } },
}}
className={className}
>
{children}
</motion.div>
);
}