Download survey_apps/main_study/src/components/ConsentForm.js from sciminds/same-words-different-judgements: direct link, hf CLI and curl.
- Browser
- Download file 2.35 kB
-
https://huggingface.co/datasets/sciminds/same-words-different-judgements/resolve/main/survey_apps/main_study/src/components/ConsentForm.js
- Command line
-
hf download hf://datasets/sciminds/same-words-different-judgements/survey_apps/main_study/src/components/ConsentForm.js
-
curl -L -o ConsentForm.js https://huggingface.co/datasets/sciminds/same-words-different-judgements/resolve/main/survey_apps/main_study/src/components/ConsentForm.js
2.35 kB
| import { useState } from "react"; | |
| function ConsentForm({ onConsentApproved, onRejected }) { | |
| const [form, setForm] = useState({ | |
| over18: false, | |
| readConsent: false, | |
| hasAudio: false, | |
| speaksEnglish: false, | |
| }); | |
| const handleChange = (e) => { | |
| const { name, checked } = e.target; | |
| setForm((prev) => ({ ...prev, [name]: checked })); | |
| }; | |
| const handleSubmit = (e) => { | |
| e.preventDefault(); | |
| const allChecked = Object.values(form).every(Boolean); | |
| if (allChecked) { | |
| onConsentApproved(); | |
| } else { | |
| onRejected(); | |
| } | |
| }; | |
| return ( | |
| <form | |
| onSubmit={handleSubmit} | |
| style={{ | |
| minHeight: '100vh', | |
| display: 'flex', | |
| flexDirection: 'column', | |
| gap: '1.5rem', | |
| padding: '1rem 2rem', // top/bottom 1rem, left/right 2rem | |
| }} | |
| > | |
| <h2 style={{ margin: 0 }}>Consent Form</h2> | |
| <div style={{ height: '66.67vh' }}> | |
| <object | |
| data="/images/consent_form.pdf" | |
| type="application/pdf" | |
| width="100%" | |
| height="100%" | |
| > | |
| <p> | |
| Your browser doesn't support embedded PDFs. | |
| <a href="/consent.pdf" target="_blank" rel="noopener noreferrer"> | |
| View the consent form | |
| </a> | |
| </p> | |
| </object> | |
| </div> | |
| <div style={{ display: 'flex', flexDirection: 'column', gap: '0.5rem' }}> | |
| <label> | |
| <input | |
| type="checkbox" | |
| name="over18" | |
| checked={form.over18} | |
| onChange={handleChange} | |
| /> | |
| {' '}I am 18 years of age or older | |
| </label> | |
| <label> | |
| <input | |
| type="checkbox" | |
| name="readConsent" | |
| checked={form.readConsent} | |
| onChange={handleChange} | |
| /> | |
| {' '}I have read and agree to the consent form | |
| </label> | |
| <label> | |
| <input | |
| type="checkbox" | |
| name="hasAudio" | |
| checked={form.hasAudio} | |
| onChange={handleChange} | |
| /> | |
| {' '}I have access to a device that can play audio | |
| </label> | |
| <label> | |
| <input | |
| type="checkbox" | |
| name="speaksEnglish" | |
| checked={form.speaksEnglish} | |
| onChange={handleChange} | |
| /> | |
| {' '}I can understand and speak English | |
| </label> | |
| </div> | |
| <button | |
| type="submit" | |
| style={{ | |
| marginTop: '1rem', | |
| padding: '0.5rem 1rem', | |
| alignSelf: 'flex-start', | |
| }} | |
| > | |
| Continue | |
| </button> | |
| </form> | |
| ); | |
| } | |
| export default ConsentForm; |