Skip to content

Commit a327e38

Browse files
authoredApr 7, 2021
Merge pull request #10 from Pyrax/feat-recaptcha-props
Feat recaptcha props
2 parents 0dcc9dc + 22d4b24 commit a327e38

File tree

3 files changed

+19
-10
lines changed

3 files changed

+19
-10
lines changed
 

‎.prettierrc

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@
66
"bracketSpacing": true,
77
"jsxBracketSameLine": false,
88
"arrowParens": "always",
9-
"trailingComma": "none"
9+
"trailingComma": "none",
10+
"endOfLine": "auto"
1011
}

‎src/recaptcha.js

+12-5
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,19 @@ import React from 'react'
22
import { useNetlifyFormContext } from './netlify-form-context'
33
import GoogleRecaptcha from 'react-google-recaptcha'
44

5-
export const Recaptcha = ({ siteKey = '', invisible = false }) => {
5+
export const Recaptcha = ({
6+
siteKey = '',
7+
invisible = false,
8+
...passThroughProps
9+
}) => {
610
const { recaptchaRef } = useNetlifyFormContext()
711

8-
return invisible ? (
9-
<GoogleRecaptcha sitekey={siteKey} ref={recaptchaRef} size='invisible' />
10-
) : (
11-
<GoogleRecaptcha sitekey={siteKey} ref={recaptchaRef} />
12+
return (
13+
<GoogleRecaptcha
14+
{...passThroughProps}
15+
sitekey={siteKey}
16+
ref={recaptchaRef}
17+
{...(invisible ? { size: 'invisible' } : {})}
18+
/>
1219
)
1320
}

‎www/src/pages/docs.mdx

+5-4
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,11 @@ In Netlify dashboard you have to set SITE_RECAPTCHA_KEY and SITE_RECAPTCHA_SECRE
8484

8585
Available props:
8686

87-
| Name | Req | Description |
88-
| --------- | --- | ------------------------------------------------- |
89-
| siteKey | Y | Recaptcha public site key. |
90-
| invisible | N | Set whether reCAPTCHA should be invisible or not. |
87+
| Name | Req | Description |
88+
| --------- | --- | ------------------------------------------------------------------------------------------------------------------------------------------ |
89+
| siteKey | Y | Recaptcha public site key. |
90+
| invisible | N | Set whether reCAPTCHA should be invisible or not. |
91+
| *(any)* | N | Any other prop will be passed through to the [underlying component](https://www.npmjs.com/package/react-google-recaptcha#component-props). |
9192

9293
<!-- prettier-ignore -->
9394
*[Req]: Required

0 commit comments

Comments
 (0)
Please sign in to comment.