// This file was generated by build-components.mjs
// ANY EDITS WILL BE OVERWRITTEN!
import {
  Thumbnail as PreactThumbnail,
  type ThumbnailProps,
} from '@uppy/components'
import { h as preactH, render as preactRender } from '@uppy/core/utils/preact'
import { useContext, useEffect, useRef } from 'react'
import { UppyContext } from '../UppyContextProvider.js'

export default function Thumbnail(props: Omit<ThumbnailProps, 'ctx'>) {
  const ref = useRef(null)
  const ctx = useContext(UppyContext)

  useEffect(() => {
    if (ref.current) {
      preactRender(
        preactH(PreactThumbnail, {
          ...props,
          ctx,
        } satisfies ThumbnailProps),
        ref.current,
      )
    }
  }, [ctx, props])

  return <div ref={ref} />
}
