Skip to content

Commit

Permalink
refactor: review comments addressed
Browse files Browse the repository at this point in the history
  • Loading branch information
Sanskar2001 committed Sep 17, 2024
1 parent 8cf219a commit df64e42
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 16 deletions.
15 changes: 5 additions & 10 deletions src/CardSchemeComponent.res
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ module CoBadgeCardSchemeDropDown = {
<option disabled=true> {"Select a card brand"->React.string} </option>
{eligibleCardSchemes
->Array.mapWithIndex((item, i) => {
<option key={Int.toString(i)} value=item className="opacity-0 w-0 h-0">
{item->React.string}
</option>
<option key={Int.toString(i)} value=item> {item->React.string} </option>
})
->React.array}
</select>
Expand All @@ -24,8 +22,6 @@ module CoBadgeCardSchemeDropDown = {
let make = (~cardNumber, ~paymentType, ~cardBrand, ~setCardBrand) => {
let cardType = React.useMemo1(_ => cardBrand->CardUtils.getCardType, [cardBrand])
let animate = cardType == NOTFOUND ? "animate-slideLeft" : "animate-slideRight"
let isCardCoBadged = Recoil.useRecoilValueFromAtom(RecoilAtoms.isCardCoBadged)
let setIsCardCoBadged = Recoil.useSetRecoilState(RecoilAtoms.isCardCoBadged)
let cardBrandIcon = React.useMemo1(
_ => CardUtils.getCardBrandIcon(cardType, paymentType),
[cardBrand],
Expand All @@ -42,12 +38,11 @@ let make = (~cardNumber, ~paymentType, ~cardBrand, ~setCardBrand) => {
~enabledCardSchemes,
)

React.useEffect1(() => {
setIsCardCoBadged(_ => eligibleCardSchemes->Array.length > 1)
None
}, [[eligibleCardSchemes]])
let isCardCoBadged = eligibleCardSchemes->Array.length > 1

<div className={`${animate} flex items-center`}>
let marginLeft = isCardCoBadged ? "-ml-2" : ""

<div className={`${animate} flex items-center ${marginLeft} hellow-rodl`}>
cardBrandIcon
<RenderIf condition={isCardCoBadged}>
<CoBadgeCardSchemeDropDown eligibleCardSchemes setCardBrand />
Expand Down
3 changes: 1 addition & 2 deletions src/Components/PaymentInputField.res
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ let make = (
~placeholder="",
~appearance: CardThemeType.appearance,
~className="",
~rightIconClassName="-ml-10",
~inputRef,
) => {
let {themeObj, config} = Recoil.useRecoilValueFromAtom(configAtom)
Expand Down Expand Up @@ -132,7 +131,7 @@ let make = (
</div>
</RenderIf>
</div>
<div className={`relative flex ${rightIconClassName} items-center`}> {rightIcon} </div>
<div className="relative flex -ml-10 items-center"> {rightIcon} </div>
</div>
<RenderIf condition={innerLayout === Spaced}>
{switch errorString {
Expand Down
3 changes: 0 additions & 3 deletions src/Payments/CardPayment.res
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ let make = (
let options = Recoil.useRecoilValueFromAtom(RecoilAtoms.optionAtom)
let loggerState = Recoil.useRecoilValueFromAtom(RecoilAtoms.loggerAtom)
let paymentMethodListValue = Recoil.useRecoilValueFromAtom(PaymentUtils.paymentMethodListValue)
let isCardCoBadged = Recoil.useRecoilValueFromAtom(RecoilAtoms.isCardCoBadged)

let (nickname, setNickname) = React.useState(_ => "")

Expand Down Expand Up @@ -219,7 +218,6 @@ let make = (
!isBancontact

let nicknameFieldClassName = conditionsForShowingSaveCardCheckbox ? "pt-2" : "pt-5"
let cardInputRightIconClassName = isCardCoBadged ? "-ml-12" : "-ml-10"

let compressedLayoutStyleForCvcError =
innerLayout === Compressed && cvcError->String.length > 0 ? "!border-l-0" : ""
Expand Down Expand Up @@ -258,7 +256,6 @@ let make = (
? "border-b-0"
: ""}
name=TestUtils.cardNoInputTestId
rightIconClassName=cardInputRightIconClassName
/>
<div
className="flex flex-row w-full place-content-between"
Expand Down
1 change: 0 additions & 1 deletion src/Utilities/RecoilAtoms.res
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ let userVpaId = Recoil.atom("userVpaId", defaultFieldValues)
let userPixKey = Recoil.atom("userPixKey", defaultFieldValues)
let userPixCPF = Recoil.atom("userPixCPF", defaultFieldValues)
let userPixCNPJ = Recoil.atom("userPixCNPJ", defaultFieldValues)
let isCardCoBadged = Recoil.atom("isCardCoBadged", false)

type areOneClickWalletsRendered = {
isGooglePay: bool,
Expand Down

0 comments on commit df64e42

Please sign in to comment.