mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-29 18:46:20 -05:00
Add recognition text and links to the bottom of the page.
Adds a prop to the Page component so each page can say whether or not it wants them to appear.
This commit is contained in:
parent
38b88f1b4c
commit
b89fe1a985
7 changed files with 117 additions and 4 deletions
36
src/components/page/www/donor-recognition.jsx
Normal file
36
src/components/page/www/donor-recognition.jsx
Normal 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);
|
38
src/components/page/www/donor-recognition.scss
Normal file
38
src/components/page/www/donor-recognition.scss
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -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;
|
||||||
|
|
|
@ -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",
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,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" />
|
||||||
|
|
|
@ -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}
|
||||||
);
|
);
|
||||||
|
|
21
test/unit/components/page.test.jsx
Normal file
21
test/unit/components/page.test.jsx
Normal 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);
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in a new issue