"use client";

import { motion, type HTMLMotionProps } from "framer-motion";

type Props = HTMLMotionProps<"div"> & {
  delay?: number;
};

export function AnimateOnScroll({ children, delay = 0, className = "", ...rest }: Props) {
  return (
    <motion.div
      initial={{ opacity: 0, y: 24 }}
      whileInView={{ opacity: 1, y: 0 }}
      viewport={{ once: true, amount: 0.08, margin: "0px 0px -40px 0px" }}
      transition={{ duration: 0.6, ease: "easeOut", delay: delay / 1000 }}
      className={className}
      {...rest}
    >
      {children}
    </motion.div>
  );
}
