Skip to content

Commit

Permalink
refactor(client): migrate Bootstrap components in update-stripe-card (f…
Browse files Browse the repository at this point in the history
  • Loading branch information
huyenltnguyen authored Jan 5, 2024
1 parent c93db95 commit f3ce85d
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions client/src/components/Donation/card-update-alert-handler.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Alert, Button } from '@freecodecamp/react-bootstrap';
import React from 'react';
import { useTranslation } from 'react-i18next';
import Spinner from 'react-spinkit';
import { Alert } from '@freecodecamp/ui';

type CardUpdateAlertHandlerProps = {
error: string | null;
Expand All @@ -19,21 +19,15 @@ function CardUpdateAlertHandler({
const { t } = useTranslation();
const style = redirecting ? 'info' : success ? 'success' : 'danger';

const heading = redirecting
const message = redirecting
? `${t('donate.redirecting')}`
: success
? `${t('donate.success-card-update')}`
: `${t('donate.error-card-update')}`;

return (
<Alert
bsStyle={style}
className='donation-completion'
closeLabel={t('buttons.close')}
>
<h4>
<b>{heading}</b>
</h4>
<Alert variant={style} className='donation-completion'>
<p>{message}</p>
<div className='donation-completion-body'>
{redirecting && (
<Spinner
Expand All @@ -48,9 +42,9 @@ function CardUpdateAlertHandler({
<div className='donation-completion-buttons'>
{error && (
<div>
<Button bsStyle='primary' onClick={reset}>
<button type='button' className='try-again-button' onClick={reset}>
{t('buttons.try-again')}
</Button>
</button>
</div>
)}
</div>
Expand Down

0 comments on commit f3ce85d

Please sign in to comment.