From 150cd44689386b8bdf8af946c5dbbca3f9255fbb Mon Sep 17 00:00:00 2001 From: Gary Tou Date: Fri, 25 Oct 2024 21:21:31 -0700 Subject: [PATCH 01/10] Move "organization" I18n into a reusable hook --- components/fiscal-sponsorship/apply/org-form.js | 7 ++----- components/fiscal-sponsorship/organizationI18n.js | 11 +++++++++++ 2 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 components/fiscal-sponsorship/organizationI18n.js diff --git a/components/fiscal-sponsorship/apply/org-form.js b/components/fiscal-sponsorship/apply/org-form.js index 88025572..0ca69948 100644 --- a/components/fiscal-sponsorship/apply/org-form.js +++ b/components/fiscal-sponsorship/apply/org-form.js @@ -4,13 +4,10 @@ import Checkbox from './checkbox' import Field from './field' // This is using country-list instead of country-list-js as it has a smaller bundle size import { getNames } from 'country-list' +import useOrganizationI18n from '../organizationI18n' export default function OrganizationInfoForm({ requiredFields }) { - const [org, setOrg] = useState('Organization') - - useEffect(() => { - if (navigator.language === 'en-GB') setOrg('Organisation') - }, []) + const org = useOrganizationI18n() return ( <> diff --git a/components/fiscal-sponsorship/organizationI18n.js b/components/fiscal-sponsorship/organizationI18n.js new file mode 100644 index 00000000..3cdd78f2 --- /dev/null +++ b/components/fiscal-sponsorship/organizationI18n.js @@ -0,0 +1,11 @@ +import { useState, useEffect } from 'react' + +export default function useOrganizationI18n() { + const [org, setOrg] = useState('Organization') + + useEffect(() => { + if (navigator.language === 'en-GB') setOrg('Organisation') + }, []) + + return org +} From 2334c882549bac406c753232b54a34ec00e975d2 Mon Sep 17 00:00:00 2001 From: Gary Tou Date: Fri, 25 Oct 2024 21:21:32 -0700 Subject: [PATCH 02/10] Add form questions for adults --- .../apply/org-adult-form.js | 71 +++++++++++++++++++ .../fiscal-sponsorship/apply/org-form.js | 3 + pages/fiscal-sponsorship/apply/index.js | 3 + 3 files changed, 77 insertions(+) create mode 100644 components/fiscal-sponsorship/apply/org-adult-form.js diff --git a/components/fiscal-sponsorship/apply/org-adult-form.js b/components/fiscal-sponsorship/apply/org-adult-form.js new file mode 100644 index 00000000..5aa98f69 --- /dev/null +++ b/components/fiscal-sponsorship/apply/org-adult-form.js @@ -0,0 +1,71 @@ +import { useState } from 'react' +import { Input, Select, Textarea } from 'theme-ui' +import Field from './field' +import useOrganizationI18n from '../organizationI18n' + +export default function OrganizationAdultForm({ requiredFields }) { + const org = useOrganizationI18n() + const [teenagerLed, setTeenagerLed] = useState('true') + + const onTeenagerLedChange = e => setTeenagerLed(e.target.value) + + return ( + <> + + + + + {teenagerLed === 'false' && ( + <> + +