import ReCAPTCHA, { ReCAPTCHAProps } from "react-google-recaptcha"

const GOOGLE_RECAPTCHA_KEY = process.env.NEXT_PUBLIC_RECAPTCHA_GOOGLE || ''

type Props = Omit<ReCAPTCHAProps, 'sitekey'> & {
  sitekey?: string;
}

const ReCaptcha = (props: Props) => {
  const { sitekey, ...rest } = props

  return (
    <ReCAPTCHA sitekey={sitekey || GOOGLE_RECAPTCHA_KEY} {...rest} />
  )
}

export default ReCaptcha