sozsoft-platform/ui/src/components/shared/Captcha.tsx

28 lines
689 B
TypeScript
Raw Normal View History

2026-02-24 20:44:16 +00:00
import { Turnstile, TurnstileInstance } from '@marsidev/react-turnstile'
import { Ref, forwardRef } from 'react'
export interface CaptchaProps {
className?: string
onError: () => void
onExpire: () => void
onSuccess: (token: string) => void
}
const Captcha = forwardRef((props: CaptchaProps, ref: Ref<TurnstileInstance>) => {
const { className, onError, onExpire, onSuccess } = props
return (
<Turnstile
ref={ref}
className={className ?? 'mb-4 mx-auto'}
siteKey="0x4AAAAAABdEjmiXxcl0j7jp"
onError={onError}
onExpire={onExpire}
onSuccess={onSuccess}
/>
)
})
Captcha.displayName = 'Captcha'
export default Captcha