Files

65 lines
1.3 KiB
TypeScript

"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>
);
}