export type IsVisibleProps = {
  target: HTMLElement
  parent?: HTMLElement
  bound?: number
}
export const isVisible = ({
  target,
  parent = document.body,
  bound = 0
}: IsVisibleProps) => {
  const parentRect = parent.getBoundingClientRect()
  const targetRect = target.getBoundingClientRect()
  const targetTop = targetRect.top - parentRect.top
  return targetTop + targetRect.height > bound
}
