Update components/in-view-div.tsx

This commit is contained in:
kleap-admin 2026-01-15 13:03:25 +00:00
parent 97bc0acc1e
commit 4ea0e024ab
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>
);
}