Merge pull request #3583 from picklesrus/footer-stuff

Add recognition text and links to the bottom of the page.
This commit is contained in:
picklesrus 2019-12-04 17:23:34 -05:00 committed by GitHub
commit 52ae6f791e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 117 additions and 4 deletions

View file

@ -0,0 +1,36 @@
const FormattedMessage = require('react-intl').FormattedMessage;
const injectIntl = require('react-intl').injectIntl;
const React = require('react');
require('./donor-recognition.scss');
const DonorRecognition = () => (
<div id="donor-text">
<div>
<FormattedMessage
id="footer.donorRecognition"
values={{
donorLink: (
<a
href="/credits#donors"
>
<FormattedMessage id="footer.donors" />
</a>
)
}}
/>
</div>
<div>
<FormattedMessage
id="footer.donorList"
values={{
donor1: 'Massachusetts Institue of Technology',
donor2: 'National Science Foundation',
donor3: 'Siegel Family Endowment'
}}
/>
</div>
</div>
);
module.exports = injectIntl(DonorRecognition);

View file

@ -0,0 +1,38 @@
@import "../../../colors";
@import "../../../frameless";
#donor {
color: $type-gray;
font-size: .875rem;
line-height: 1.5em;
background-color: $ui-gray;
padding-bottom: 2.5rem;
padding-top: 1rem;
#donor-text {
text-align: center;
width: $cols12;
margin: 0 auto;
}
}
@media only screen and (min-width: $tabletPortrait) and (max-width: $desktop) {
#donor {
#donor-text {
width: $cols11;
}
}
}
@media only screen and (min-width: $mobile) and (max-width: $tabletPortrait) {
#donor {
#donor-text {
width: $cols6;
}
}
}
@media only screen and (max-width: $mobile) {
#donor {
#donor-text {
width: $cols4;
}
}
}

View file

@ -4,11 +4,13 @@ const React = require('react');
const Navigation = require('../../navigation/www/navigation.jsx'); const Navigation = require('../../navigation/www/navigation.jsx');
const Footer = require('../../footer/www/footer.jsx'); const Footer = require('../../footer/www/footer.jsx');
const DonorRecognition = require('./donor-recognition.jsx');
const ErrorBoundary = require('../../errorboundary/errorboundary.jsx'); const ErrorBoundary = require('../../errorboundary/errorboundary.jsx');
const Page = ({ const Page = ({
children, children,
className className,
showDonorRecognition
}) => ( }) => (
<ErrorBoundary componentName="Page"> <ErrorBoundary componentName="Page">
<div className={classNames('page', className)}> <div className={classNames('page', className)}>
@ -26,13 +28,19 @@ const Page = ({
<div id="footer"> <div id="footer">
<Footer /> <Footer />
</div> </div>
{showDonorRecognition &&
<div id="donor">
<DonorRecognition />
</div>
}
</div> </div>
</ErrorBoundary> </ErrorBoundary>
); );
Page.propTypes = { Page.propTypes = {
children: PropTypes.node, children: PropTypes.node,
className: PropTypes.string className: PropTypes.string,
showDonorRecognition: PropTypes.bool
}; };
module.exports = Page; module.exports = Page;

View file

@ -122,6 +122,9 @@
"footer.discuss": "Discussion Forums", "footer.discuss": "Discussion Forums",
"footer.scratchFamily": "Scratch Family", "footer.scratchFamily": "Scratch Family",
"footer.donorRecognition": "Scratch is available for free, thanks to generous support from our {donorLink}. We are grateful to our Founding Partners:",
"footer.donors": "donors",
"footer.donorList": "{donor1}, {donor2}, and {donor3}",
"form.validationRequired": "This field is required", "form.validationRequired": "This field is required",

View file

@ -54,7 +54,10 @@ const Credits = () => (
))} ))}
</ul> </ul>
</div> </div>
<div className="supporters"> <div
className="supporters"
id="donors"
>
<div className="mid-header"> <div className="mid-header">
<h2> <h2>
<FormattedMessage id="credits.currentSponsors" /> <FormattedMessage id="credits.currentSponsors" />

View file

@ -271,7 +271,11 @@ const ConnectedSplash = connect(
)(Splash); )(Splash);
render( render(
<Page><ConnectedSplash /></Page>, <Page
showDonorRecognition
>
<ConnectedSplash />
</Page>,
document.getElementById('app'), document.getElementById('app'),
{splash: splashActions.splashReducer} {splash: splashActions.splashReducer}
); );

View file

@ -0,0 +1,21 @@
const React = require('react');
const {shallowWithIntl} = require('../../helpers/intl-helpers.jsx');
const Page = require('../../../src/components/page/www/page.jsx');
describe('Page', () => {
test('Do not show donor recognition', () => {
const component = shallowWithIntl(
<Page />
);
expect(component.find('#donor')).toHaveLength(0);
});
test('Show donor recognition', () => {
const component = shallowWithIntl(
<Page
showDonorRecognition
/>
);
expect(component.find('#donor')).toHaveLength(1);
});
});