mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-23 07:38:07 -05:00
- Fix routes
- move functions to inline rendering in ttt-tile and mw homepage
This commit is contained in:
parent
7bbb498a4f
commit
485d3903e0
3 changed files with 18 additions and 34 deletions
|
@ -14,16 +14,6 @@ var TTTTile = React.createClass({
|
||||||
tutorialLoc: React.PropTypes.string.isRequired,
|
tutorialLoc: React.PropTypes.string.isRequired,
|
||||||
onGuideClick: React.PropTypes.func.isRequired
|
onGuideClick: React.PropTypes.func.isRequired
|
||||||
},
|
},
|
||||||
tileGuidesIfExists: function () {
|
|
||||||
if (this.props.onGuideClick) {
|
|
||||||
return (
|
|
||||||
<div className="ttt-tile-guides" onClick={this.props.onGuideClick}>
|
|
||||||
<FormattedMessage id='tile.guides' defaultMessage='See Cards and Guides'/>
|
|
||||||
<img className="ttt-tile-see-more" src="/svgs/ttt/see-more.svg" />
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
render: function () {
|
render: function () {
|
||||||
var classes = classNames(
|
var classes = classNames(
|
||||||
'ttt-tile',
|
'ttt-tile',
|
||||||
|
@ -54,7 +44,12 @@ var TTTTile = React.createClass({
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</a>
|
</a>
|
||||||
{this.tileGuidesIfExists()}
|
{this.props.onGuideClick && (
|
||||||
|
<div className="ttt-tile-guides" onClick={this.props.onGuideClick}>
|
||||||
|
<FormattedMessage id='tile.guides' defaultMessage='See Cards and Guides'/>
|
||||||
|
<img className="ttt-tile-see-more" src="/svgs/ttt/see-more.svg" />
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -250,7 +250,7 @@
|
||||||
{
|
{
|
||||||
"name": "microworlds-homepage",
|
"name": "microworlds-homepage",
|
||||||
"pattern": "^/microworlds/go/?(\\?.*)?$",
|
"pattern": "^/microworlds/go/?(\\?.*)?$",
|
||||||
"routeAlias": "microworlds",
|
"routeAlias": "/microworlds",
|
||||||
"view": "microworldshomepage/microworldshomepage",
|
"view": "microworldshomepage/microworldshomepage",
|
||||||
"title": "Microworlds"
|
"title": "Microworlds"
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,27 +14,6 @@ require('./microworldshomepage.scss');
|
||||||
|
|
||||||
var MicroworldsHomepage = injectIntl(React.createClass({
|
var MicroworldsHomepage = injectIntl(React.createClass({
|
||||||
type: 'MicroworldsHomepage',
|
type: 'MicroworldsHomepage',
|
||||||
renderTTTTiles: function () {
|
|
||||||
var formatMessage = this.props.intl.formatMessage;
|
|
||||||
var translatedTiles = [];
|
|
||||||
var translatedTile = {};
|
|
||||||
|
|
||||||
Tiles.map(function (tile, key) {
|
|
||||||
translatedTile = {
|
|
||||||
title: formatMessage({id: tile.title}),
|
|
||||||
tutorialLoc: tile.tutorialLoc,
|
|
||||||
thumbUrl: tile.thumbUrl,
|
|
||||||
bannerUrl: tile.bannerUrl
|
|
||||||
};
|
|
||||||
translatedTiles.push(
|
|
||||||
<TTTTile
|
|
||||||
key={key}
|
|
||||||
{...translatedTile}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}, this); // don't forget to pass 'this' into map function
|
|
||||||
return translatedTiles;
|
|
||||||
},
|
|
||||||
render: function () {
|
render: function () {
|
||||||
return (
|
return (
|
||||||
<div className="microworlds">
|
<div className="microworlds">
|
||||||
|
@ -48,7 +27,17 @@ var MicroworldsHomepage = injectIntl(React.createClass({
|
||||||
</TitleBanner>
|
</TitleBanner>
|
||||||
<div className="inner">
|
<div className="inner">
|
||||||
<MasonryGrid >
|
<MasonryGrid >
|
||||||
{this.renderTTTTiles()}
|
{Tiles.map(
|
||||||
|
function (tile, key) {
|
||||||
|
return <TTTTile
|
||||||
|
key={key}
|
||||||
|
title={this.props.intl.formatMessage({id: tile.title})}
|
||||||
|
tutorialLoc={tile.tutorialLoc}
|
||||||
|
thumbUrl={tile.thumbUrl}
|
||||||
|
bannerUrl={tile.bannerUrl}
|
||||||
|
/>;
|
||||||
|
}, this)
|
||||||
|
}
|
||||||
</MasonryGrid>
|
</MasonryGrid>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue