-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
captchadoc.js
73 lines (63 loc) · 2.08 KB
/
captchadoc.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import { DocSectionCode } from '@/components/doc/common/docsectioncode';
import { DocSectionText } from '@/components/doc/common/docsectiontext';
import { Captcha } from '@/components/lib/captcha/Captcha';
import { Toast } from '@/components/lib/toast/Toast';
import { useRef } from 'react';
export function CaptchaDoc(props) {
const toast = useRef(null);
const showResponse = () => {
toast.current.show({ severity: 'info', summary: 'Success', detail: 'User Responded' });
};
const code = {
basic: `
<Toast ref={toast}></Toast>
<Captcha siteKey="YOUR_SITE_KEY" onResponse={showResponse} />
`,
javascript: `
import React, { useRef } from 'react';
import { Ripple } from 'primereact/ripple';
import { Captcha } from 'primereact/captcha';
export default function CaptchaDoc() {
const toast = useRef(null);
const showResponse = () => {
toast.current.show({ severity: 'info', summary: 'Success', detail: 'User Responded' });
};
return (
<div className="card">
<Toast ref={toast}></Toast>
<Captcha siteKey="YOUR_SITE_KEY" onResponse={showResponse} />
</div>
);
}
`,
typescript: `
import React, { useRef } from 'react';
import { Ripple } from 'primereact/ripple';
import { Captcha } from 'primereact/captcha';
export default function CaptchaDoc() {
const toast = useRef<Toast>(null);
const showResponse = () => {
toast.current?.show({ severity: 'info', summary: 'Success', detail: 'User Responded' });
};
return (
<div className="card">
<Toast ref={toast}></Toast>
<Captcha siteKey="YOUR_SITE_KEY" onResponse={showResponse} />
</div>
);
}
`
};
return (
<>
<DocSectionText {...props}>
<p>Styling Demo Content.</p>
</DocSectionText>
<div className="card">
<Toast ref={toast} />
<Captcha siteKey="YOUR_SITE_KEY" onResponse={showResponse} />
</div>
<DocSectionCode code={code} />
</>
);
}