import { useEffect, useRef } from 'react';

export const useFixedHeightPagination = (data: any, pageSize: number) => {
  const tableRef = useRef<HTMLDivElement>(null);

  useEffect(() => {
    if (tableRef.current) {
      const height = tableRef.current.clientHeight;
      if (height > 0) {
        tableRef.current.style.height = height + 'px';
      }
    }
  }, [data, pageSize]);

  return { tableRef };
};
