CaptchaInput.tsx 527 Bytes
Newer Older
Oleksii Savran's avatar
Oleksii Savran committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import * as React from 'react';
import ReCAPTCHA from 'react-google-recaptcha';

interface ICaptchaInputProps extends React.ClassAttributes<any> {
  onChange: (...args) => void;
  captchaClientKey: string;
}

export default class CaptchaInput extends React.Component<ICaptchaInputProps> {
  public render() {
    const { captchaClientKey, onChange } = this.props;

    return !captchaClientKey ?
      null : (
        <ReCAPTCHA
          sitekey={ captchaClientKey }
          onChange={ onChange }
        />
      );
  }
}