fix: Handle goal reached 🎉

This commit is contained in:
Bouncey
2018-12-03 17:47:30 +00:00
committed by mrugesh mohapatra
parent 1fba44f722
commit 2e578a7af8

View File

@ -17,22 +17,33 @@ const supportersLocale = supporterGoal.toLocaleString();
function Supporters({ isDonating, activeDonations }) { function Supporters({ isDonating, activeDonations }) {
const donationsLocale = activeDonations.toLocaleString(); const donationsLocale = activeDonations.toLocaleString();
const isGoalReached = activeDonations >= supporterGoal;
return ( return (
<Fragment> <Fragment>
<FullWidthRow> <FullWidthRow>
<h2>Support an open future.</h2> <h2>Support an open future.</h2>
</FullWidthRow> </FullWidthRow>
<FullWidthRow> {isGoalReached ? (
<div id='supporter-progress-wrapper'> <FullWidthRow>
<ProgressBar max={10000} now={activeDonations} /> <Spacer />
<div id='progress-label-wrapper'> <p>
<span className='progress-label'> 🎉 {donationsLocale} supporters help keep freeCodeCamp.org free to
{donationsLocale} supporters out of {supportersLocale} supporter use
goal </p>
</span> </FullWidthRow>
) : (
<FullWidthRow>
<div id='supporter-progress-wrapper'>
<ProgressBar max={supporterGoal} now={activeDonations} />
<div id='progress-label-wrapper'>
<span className='progress-label'>
{donationsLocale} supporters out of {supportersLocale} supporter
goal
</span>
</div>
</div> </div>
</div> </FullWidthRow>
</FullWidthRow> )}
<Spacer /> <Spacer />
<FullWidthRow> <FullWidthRow>
<b> <b>