feat: Add supporter UI to /welcome
This commit is contained in:
committed by
mrugesh mohapatra
parent
4145efc467
commit
785f8ac384
57
client/src/components/Supporters.js
Normal file
57
client/src/components/Supporters.js
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
import React, { Fragment } from 'react';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
import { Button, ProgressBar } from '@freecodecamp/react-bootstrap';
|
||||||
|
|
||||||
|
import FullWidthRow from '../components/helpers/FullWidthRow';
|
||||||
|
|
||||||
|
import './supporters.css';
|
||||||
|
|
||||||
|
const propTypes = { isDonating: PropTypes.bool.isRequired };
|
||||||
|
|
||||||
|
function Supporters({ isDonating }) {
|
||||||
|
return (
|
||||||
|
<Fragment>
|
||||||
|
<FullWidthRow>
|
||||||
|
<h2>Support an open future.</h2>
|
||||||
|
</FullWidthRow>
|
||||||
|
<FullWidthRow>
|
||||||
|
<div id='supporter-progress-wrapper'>
|
||||||
|
<ProgressBar
|
||||||
|
label={'4000 supporters out of 10,000 goal'}
|
||||||
|
max={10000}
|
||||||
|
now={4000}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</FullWidthRow>
|
||||||
|
<FullWidthRow>
|
||||||
|
<b>
|
||||||
|
<p>
|
||||||
|
freeCodeCamp.org is a tiny non-profit that's helping millions of
|
||||||
|
people learn to code for free. <br />
|
||||||
|
{isDonating
|
||||||
|
? 'Thank you for supporting freeCodeCamp.org'
|
||||||
|
: 'Join 4,000 supporters. Your $5 / month donation will help ' +
|
||||||
|
'keep tech education free and open.'}
|
||||||
|
</p>
|
||||||
|
</b>
|
||||||
|
</FullWidthRow>
|
||||||
|
{isDonating ? null : (
|
||||||
|
<FullWidthRow>
|
||||||
|
<Button
|
||||||
|
bsSize='lg'
|
||||||
|
bsStyle='primary'
|
||||||
|
href='https://donate.freecodecamp.org'
|
||||||
|
target='_blank'
|
||||||
|
>
|
||||||
|
Click here to become a Supporter
|
||||||
|
</Button>
|
||||||
|
</FullWidthRow>
|
||||||
|
)}
|
||||||
|
</Fragment>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Supporters.displayName = 'Supporters';
|
||||||
|
Supporters.propTypes = propTypes;
|
||||||
|
|
||||||
|
export default Supporters;
|
7
client/src/components/supporters.css
Normal file
7
client/src/components/supporters.css
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#supporter-progress-wrapper .progress {
|
||||||
|
height: 38px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#supporter-progress-wrapper .progress-bar {
|
||||||
|
padding-top: 8px;
|
||||||
|
}
|
@ -10,6 +10,7 @@ import Helmet from 'react-helmet';
|
|||||||
import { Loader, Spacer } from '../components/helpers';
|
import { Loader, Spacer } from '../components/helpers';
|
||||||
import CurrentChallengeLink from '../components/helpers/CurrentChallengeLink';
|
import CurrentChallengeLink from '../components/helpers/CurrentChallengeLink';
|
||||||
import Layout from '../components/layouts/Default';
|
import Layout from '../components/layouts/Default';
|
||||||
|
import Supporters from '../components/Supporters';
|
||||||
import {
|
import {
|
||||||
userSelector,
|
userSelector,
|
||||||
userFetchStateSelector,
|
userFetchStateSelector,
|
||||||
@ -32,7 +33,8 @@ const propTypes = {
|
|||||||
completedChallengeCount: PropTypes.number,
|
completedChallengeCount: PropTypes.number,
|
||||||
completedProjectCount: PropTypes.number,
|
completedProjectCount: PropTypes.number,
|
||||||
completedCertCount: PropTypes.number,
|
completedCertCount: PropTypes.number,
|
||||||
completedLegacyCertCount: PropTypes.number
|
completedLegacyCertCount: PropTypes.number,
|
||||||
|
isDonating: PropTypes.bool
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -53,7 +55,8 @@ function Welcome({
|
|||||||
completedChallengeCount: completedChallenges = 0,
|
completedChallengeCount: completedChallenges = 0,
|
||||||
completedProjectCount = 0,
|
completedProjectCount = 0,
|
||||||
completedCertCount = 0,
|
completedCertCount = 0,
|
||||||
completedLegacyCertCount: completedLegacyCerts = 0
|
completedLegacyCertCount: completedLegacyCerts = 0,
|
||||||
|
isDonating
|
||||||
}
|
}
|
||||||
}) {
|
}) {
|
||||||
if (pending && !complete) {
|
if (pending && !complete) {
|
||||||
@ -91,6 +94,8 @@ function Welcome({
|
|||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
<Spacer />
|
<Spacer />
|
||||||
|
<Supporters isDonating={isDonating} />
|
||||||
|
<Spacer size={2} />
|
||||||
<Row>
|
<Row>
|
||||||
<Col sm={8} smOffset={2} xs={12}>
|
<Col sm={8} smOffset={2} xs={12}>
|
||||||
<a
|
<a
|
||||||
|
Reference in New Issue
Block a user