Skip to content

Commit

Permalink
Merge pull request #55 from casper-network/update-11-14
Browse files Browse the repository at this point in the history
Newsletter Form fix
  • Loading branch information
msalmeron authored Nov 21, 2023
2 parents b376e2e + 581e174 commit 0eab481
Showing 1 changed file with 29 additions and 7 deletions.
36 changes: 29 additions & 7 deletions src/components/Shared/NewsletterFormComponent/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export default function NewsletterFormComponent({ newsletterData }: any) {
const [languageOptions, setLanguageOptions] = useState([]);
const [interestsOptions, setInterestsOptions] = useState([]);
const [blockchainOptions, setBlockchainOptions] = useState([]);
const [legalConsentOptions, setLegalConsentOptions] = useState<any>(null);

const [submitError, setSubmitError] = useState<string>("");
const [submitSuccess, setSubmitSuccess] = useState<string>("");
Expand All @@ -26,6 +27,7 @@ export default function NewsletterFormComponent({ newsletterData }: any) {
setLanguageOptions(json.languageOptions);
setInterestsOptions(json.interestsOptions);
setBlockchainOptions(json.blockchainOptions);
setLegalConsentOptions(json.legalConsentOptions);
};

getData();
Expand Down Expand Up @@ -172,7 +174,17 @@ export default function NewsletterFormComponent({ newsletterData }: any) {
country_dropdown: selectValues["country_label"],
preferred_programming_language: selectValues["preferred_language_label"] ?? "",
interests__developer_portal_: selectValues["interests_label"] ?? "",
blockchain_familiarity: selectValues["blockchain_familiarity_label"] ?? ""
blockchain_familiarity: selectValues["blockchain_familiarity_label"] ?? "",
legal_consent: {
value: agree,
subscriptionTypeId: legalConsentOptions.communicationsCheckboxes[0].subscriptionTypeId,
text: legalConsentOptions.communicationsCheckboxes[0].label
},
page_context: {
hutk: null,
pageUri: location.href,
pageName: document.title
}
})
});

Expand Down Expand Up @@ -318,8 +330,14 @@ export default function NewsletterFormComponent({ newsletterData }: any) {
>
{icons.check}
</label>

<span className="primaryParagraph">{newsletterData.agree_label}</span>
{legalConsentOptions && (
<span
className="primaryParagraph"
dangerouslySetInnerHTML={{
__html: legalConsentOptions.communicationsCheckboxes[0].label
}}
></span>
)}
</div>
{agreeError && (
<label htmlFor="Agree Error" className={styles.error}>
Expand All @@ -329,10 +347,14 @@ export default function NewsletterFormComponent({ newsletterData }: any) {
</div>

<div className={styles.description}>
<div
className={`${styles.paragraphContainer} secondaryParagraph`}
dangerouslySetInnerHTML={{ __html: newsletterData.description! }}
></div>
{legalConsentOptions && (
<div className={`${styles.paragraphContainer} secondaryParagraph`}>
<div dangerouslySetInnerHTML={{ __html: legalConsentOptions.privacyText }}></div>
<div
dangerouslySetInnerHTML={{ __html: legalConsentOptions.consentToProcessText }}
></div>
</div>
)}
</div>
<div>
<button type="button" className={`${styles.button} ${styles.primary}`} onClick={handleSubmit}>
Expand Down

0 comments on commit 0eab481

Please sign in to comment.