diff --git a/components/testimonial-column-container.tsx b/components/testimonial-column-container.tsx new file mode 100644 index 0000000..086df9e --- /dev/null +++ b/components/testimonial-column-container.tsx @@ -0,0 +1,43 @@ +"use client"; +import { cn } from "@/lib/utils"; +import { useEffect, useRef, useState } from "react"; + +export function TestimonialColumnContainer({ + className, + shift = 0, + children, +}: { + className?: string; + shift?: number; + children: React.ReactNode; +}) { + let columnRef = useRef>(null); + let [columnHeight, setColumnHeight] = useState(0); + let duration = `${columnHeight * shift}ms`; + + useEffect(() => { + if (!columnRef.current) { + return; + } + + let resizeObserver = new window.ResizeObserver(() => { + setColumnHeight(columnRef.current?.offsetHeight ?? 0); + }); + + resizeObserver.observe(columnRef.current); + + return () => { + resizeObserver.disconnect(); + }; + }, []); + + return ( +
+ {children} +
+ ); +}