1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2026-06-29 23:45:58 -04:00

move to official hcaptcha react component

This commit is contained in:
2021-12-12 06:47:38 -05:00
parent b82be240a7
commit 0bc30f87d8
6 changed files with 108 additions and 16 deletions
+16 -4
View File
@@ -1,9 +1,9 @@
import "vanilla-hcaptcha";
import { h, render } from "preact";
import { h, Fragment, render } from "preact";
import { useState } from "preact/hooks";
import fetch from "unfetch";
// shared react components:
import HCaptcha from "@hcaptcha/react-hcaptcha";
import { CheckIcon, XIcon } from "@primer/octicons-react";
import SendEmoji from "twemoji-emojis/vendor/svg/1f4e4.svg";
@@ -114,7 +114,13 @@ const ContactForm = () => {
</div>
<div id="contact-form-captcha">
<h-captcha site-key={process.env.HCAPTCHA_SITE_KEY} size="normal" />
<HCaptcha
sitekey={process.env.HCAPTCHA_SITE_KEY}
theme={document.body.classList.contains("dark") ? "dark" : "light"}
size="normal"
reCaptchaCompat={false}
onVerify={() => true} // this is allegedly optional but a function undefined error is thrown without it
/>
</div>
<div id="contact-form-action-row">
@@ -125,7 +131,13 @@ const ContactForm = () => {
disabled={sending}
style={{ display: status.success ? "none" : null }}
>
<SendEmoji class="emoji" /> {sending ? "Sending..." : "Send"}
{sending ? (
<span>Sending...</span>
) : (
<>
<SendEmoji class="emoji" /> <span>Send</span>
</>
)}
</button>
<span
+1 -1
View File
@@ -1,4 +1,4 @@
import { h, render, Fragment } from "preact";
import { h, Fragment, render } from "preact";
import { useState, useEffect } from "preact/hooks";
import fetch from "unfetch";
import dayjs from "dayjs";