From ccdf4e30ba7ddf3e5ae2ff25ecdbbda156052680 Mon Sep 17 00:00:00 2001 From: Huyen Nguyen <25715018+huyenltnguyen@users.noreply.github.com> Date: Wed, 22 Nov 2023 02:50:44 +0700 Subject: [PATCH] refactor(client): migrate button component in donation form (#52355) Co-authored-by: Sboonny --- .../components/Donation/donate-completion.tsx | 10 +-- .../src/components/Donation/donate-form.tsx | 9 ++- .../components/Donation/donation-modal.tsx | 12 ++- client/src/components/Donation/donation.css | 76 ++++++++++++++++++- .../Donation/multi-tier-donation-form.tsx | 7 +- .../components/Donation/stripe-card-form.tsx | 7 +- 6 files changed, 91 insertions(+), 30 deletions(-) diff --git a/client/src/components/Donation/donate-completion.tsx b/client/src/components/Donation/donate-completion.tsx index efec025c1be..09ecf970cad 100644 --- a/client/src/components/Donation/donate-completion.tsx +++ b/client/src/components/Donation/donate-completion.tsx @@ -1,8 +1,8 @@ -import { Button } from '@freecodecamp/react-bootstrap'; import React from 'react'; import { useTranslation } from 'react-i18next'; import Spinner from 'react-spinkit'; import { Alert } from '@freecodecamp/ui'; + import { Spacer } from '../helpers'; type DonateCompletionProps = { @@ -57,11 +57,9 @@ function DonateCompletion({
{error && ( -
- -
+ )}
diff --git a/client/src/components/Donation/donate-form.tsx b/client/src/components/Donation/donate-form.tsx index daffc2f4ec0..8ac99336320 100644 --- a/client/src/components/Donation/donate-form.tsx +++ b/client/src/components/Donation/donate-form.tsx @@ -6,7 +6,6 @@ import { connect } from 'react-redux'; import Spinner from 'react-spinkit'; import { createSelector } from 'reselect'; import type { TFunction } from 'i18next'; -import { Button } from '@freecodecamp/react-bootstrap'; import { defaultDonation, @@ -222,9 +221,13 @@ class DonateForm extends Component { usd: formattedAmountLabel(donationAmount) })} - + ); diff --git a/client/src/components/Donation/donation-modal.tsx b/client/src/components/Donation/donation-modal.tsx index bcd6a0a4695..2172cb31630 100644 --- a/client/src/components/Donation/donation-modal.tsx +++ b/client/src/components/Donation/donation-modal.tsx @@ -1,4 +1,4 @@ -import { Modal, Button } from '@freecodecamp/react-bootstrap'; +import { Modal } from '@freecodecamp/react-bootstrap'; import { Col, Row } from '@freecodecamp/ui'; import { WindowLocation } from '@reach/router'; import React, { useEffect, useState } from 'react'; @@ -98,15 +98,13 @@ function CloseButtonRow({ return ( - + ); diff --git a/client/src/components/Donation/donation.css b/client/src/components/Donation/donation.css index 2b8346cd088..1e0cc354412 100644 --- a/client/src/components/Donation/donation.css +++ b/client/src/components/Donation/donation.css @@ -305,11 +305,28 @@ li.disabled > a { justify-content: space-between; } +/* + * We currently cannot reuse the Button component from `ui-components` + * and are using the native ` + diff --git a/client/src/components/Donation/stripe-card-form.tsx b/client/src/components/Donation/stripe-card-form.tsx index 3340d6b8447..e2d83e777c4 100644 --- a/client/src/components/Donation/stripe-card-form.tsx +++ b/client/src/components/Donation/stripe-card-form.tsx @@ -1,4 +1,3 @@ -import { Button } from '@freecodecamp/react-bootstrap'; import { CardNumberElement, CardExpiryElement, @@ -158,16 +157,14 @@ const StripeCardForm = ({
{!isSubmissionValid &&

{t('donate.valid-card')}

}
- + ); };