From 648ea87d8e2b0c989edbe7949b43a2c1e70e70cc Mon Sep 17 00:00:00 2001 From: Pritish Budhiraja <1805317@kiit.ac.in> Date: Thu, 18 Apr 2024 13:04:57 +0530 Subject: [PATCH 1/6] feat: mandate changes for Saved Card flow (#309) Co-authored-by: Vrishab Srivatsa <136090360+vsrivatsa-juspay@users.noreply.github.com> Co-authored-by: Vrishab Srivatsa --- ...edCheckbox.res => SaveDetailsCheckbox.res} | 18 ++++-- src/Components/SavedMethods.res | 48 ++++++++++++-- src/Hooks/UtilityHooks.res | 13 ++++ src/LoaderController.res | 15 ++++- src/Payments/CardPayment.res | 31 +++++----- src/Utilities/PaymentBody.res | 62 +++++++++++++------ 6 files changed, 140 insertions(+), 47 deletions(-) rename src/Components/{AnimatedCheckbox.res => SaveDetailsCheckbox.res} (70%) diff --git a/src/Components/AnimatedCheckbox.res b/src/Components/SaveDetailsCheckbox.res similarity index 70% rename from src/Components/AnimatedCheckbox.res rename to src/Components/SaveDetailsCheckbox.res index 7a6fd1726..838fe86c8 100644 --- a/src/Components/AnimatedCheckbox.res +++ b/src/Components/SaveDetailsCheckbox.res @@ -1,12 +1,14 @@ @react.component let make = (~isChecked, ~setIsChecked) => { let {themeObj} = Recoil.useRecoilValueFromAtom(RecoilAtoms.configAtom) + let showFields = Recoil.useRecoilValueFromAtom(RecoilAtoms.showCardFieldsAtom) + let {business} = Recoil.useRecoilValueFromAtom(RecoilAtoms.optionAtom) + let css = `.container { display: flex; cursor: pointer; position: relative; justify-content: center; - align-items: center; } .container input { @@ -42,17 +44,23 @@ let make = (~isChecked, ~setIsChecked) => { setIsChecked(_ => value) } let {localeString} = Recoil.useRecoilValueFromAtom(RecoilAtoms.configAtom) - let (checkboxState, checkedState, checkBoxLabelSate) = isChecked + let (checkboxState, checkedState, checkBoxLabelState) = isChecked ? ("Checkbox--checked", "CheckboxInput--checked", "CheckboxLabel--checked") : ("", "", "") + let saveCardCheckboxLabel = if showFields { + localeString.saveCardDetails + } else { + localeString.cardTerms(business.name) + } +