import { type CSSProperties } from 'react';

import { ITEM_GAP_PX } from './constants';
import { type VirtualRow } from './types';

export const getVirtualRowStyle = (
  virtualRow: VirtualRow,
  isLast: boolean,
): CSSProperties => ({
  position: 'absolute',
  top: 0,
  left: 0,
  width: '100%',
  transform: `translateY(${virtualRow.start}px)`,
  ...(isLast ? {} : { paddingBottom: ITEM_GAP_PX }),
});
