const bindAll = require('lodash.bindall'); const FormattedHTMLMessage = require('react-intl').FormattedHTMLMessage; const FormattedMessage = require('react-intl').FormattedMessage; const injectIntl = require('react-intl').injectIntl; const intlShape = require('react-intl').intlShape; const React = require('react'); const Button = require('../../components/forms/button.jsx'); const FlexRow = require('../../components/flex-row/flex-row.jsx'); const MasonryGrid = require('../../components/masonrygrid/masonrygrid.jsx'); const TitleBanner = require('../../components/title-banner/title-banner.jsx'); const TTTModal = require('../../components/modal/ttt/modal.jsx'); const TTTTile = require('../../components/ttt-tile/ttt-tile.jsx'); const Page = require('../../components/page/www/page.jsx'); const render = require('../../lib/render.jsx'); const Tiles = require('./ttt.json'); require('./tips.scss'); class Tips extends React.Component { constructor (props) { super(props); bindAll(this, [ 'handleShowTTTModal', 'handleHideTTTModal', 'renderTTTTiles' ]); this.state = { currentTile: Tiles[0], TTTModalOpen: false }; } handleShowTTTModal (tile) { // expects translated tile this.setState({ currentTile: tile, TTTModalOpen: true }); } handleHideTTTModal () { this.setState({ TTTModalOpen: false }); } renderTTTTiles () { return Tiles.map((tile, key) => { const translatedTile = { activityLoc: this.props.intl.formatMessage({id: tile.activityLoc}), bannerUrl: tile.bannerUrl, description: this.props.intl.formatMessage({id: tile.description}), guideLoc: this.props.intl.formatMessage({id: tile.guideLoc}), thumbUrl: tile.thumbUrl, title: this.props.intl.formatMessage({id: tile.title}), tutorialLoc: tile.tutorialLoc }; return ( { // eslint-disable-line react/jsx-no-bind this.handleShowTTTModal(translatedTile); }} {...translatedTile} /> ); }); } render () { return (

{this.renderTTTTiles()}

); } } Tips.propTypes = { intl: intlShape }; const WrappedTips = injectIntl(Tips); render( , document.getElementById('app'));