Update components/in-view-div.tsx

This commit is contained in:
kleap-admin 2026-01-15 13:42:05 +00:00
parent 6cb1a0fd79
commit 5a07642d73
1 changed files with 18 additions and 0 deletions

View File

@ -0,0 +1,18 @@
"use client";
import { useRef } from "react";
import { useInView } from "framer-motion";
export function InViewDiv({
children,
...props
}: { children: React.ReactNode } & any) {
const containerRef = useRef<HTMLDivElement>(null);
let isInView = useInView(containerRef, { once: true, amount: 0.4 });
return (
<div ref={containerRef} {...props}>
{isInView ? children : null}
</div>
);
}