Skip to content

Commit

Permalink
fix: make modal donation text dynamic (freeCodeCamp#38462)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmaxed authored Mar 28, 2020
1 parent a581850 commit b7e9795
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion client/src/components/Donation/DonationModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { blockNameify } from '../../../utils/blockNameify';
import Heart from '../../assets/icons/Heart';
import Cup from '../../assets/icons/Cup';
import MinimalDonateForm from './MinimalDonateForm';
import { modalDefaultStateConfig } from '../../../../config/donation-settings';

import {
closeDonationModal,
Expand Down Expand Up @@ -90,7 +91,19 @@ function DonateModal({
});
}

const donationText = <b>Become an annual supporter of our nonprofit.</b>;
const durationToText = donationDuration => {
if (donationDuration === 'onetime') return 'a one-time';
else if (donationDuration === 'month') return 'a monthly';
else if (donationDuration === 'year') return 'an annual';
else return 'a';
};

const donationText = (
<b>
Become {durationToText(modalDefaultStateConfig.donationDuration)}{' '}
supporter of our nonprofit.
</b>
);
const blockDonationText = (
<div className='block-modal-text'>
<div className='donation-icon-container'>
Expand Down

0 comments on commit b7e9795

Please sign in to comment.