scratch-www/src/components/intro/intro.jsx

156 lines
6.5 KiB
React
Raw Normal View History

2016-03-18 11:51:22 -04:00
var connect = require('react-redux').connect;
var omit = require('lodash.omit');
var React = require('react');
var actions = require('../../redux/auth.js');
2016-03-18 11:51:22 -04:00
var Modal = require('../modal/modal.jsx');
var Registration = require('../registration/registration.jsx');
require('./intro.scss');
Modal.setAppElement(document.getElementById('view'));
var Intro = React.createClass({
2015-10-09 16:16:37 -04:00
type: 'Intro',
2015-09-10 15:00:07 -04:00
getDefaultProps: function () {
return {
messages: {
'intro.aboutScratch': 'ABOUT SCRATCH',
'intro.forEducators': 'FOR EDUCATORS',
'intro.forParents': 'FOR PARENTS',
'intro.joinScratch': 'JOIN SCRATCH',
'intro.seeExamples': 'SEE EXAMPLES',
'intro.tagLine': 'Create stories, games, and animations<br /> Share with others around the world',
'intro.tryItOut': 'TRY IT OUT',
'intro.description': 'A creative learning community with <span class="project-count"> ' +
2016-04-22 14:16:59 -04:00
'over 14 million </span>projects shared'
2016-03-18 11:51:22 -04:00
},
session: {}
};
},
getInitialState: function () {
return {
videoOpen: false
};
},
showVideo: function () {
this.setState({videoOpen: true});
},
closeVideo: function () {
this.setState({videoOpen: false});
},
handleJoinClick: function (e) {
e.preventDefault();
this.setState({'registrationOpen': true});
},
closeRegistration: function () {
this.setState({'registrationOpen': false});
},
completeRegistration: function () {
2016-03-18 11:51:22 -04:00
this.props.dispatch(actions.refreshSession());
this.closeRegistration();
},
render: function () {
var frameProps = {
width: 570,
height: 357,
padding: 15
};
return (
2015-09-11 09:43:10 -04:00
<div className="intro">
<div className="content">
<h1 dangerouslySetInnerHTML={{__html: this.props.messages['intro.tagLine']}}>
</h1>
<div className="sprites">
2015-09-11 09:43:10 -04:00
<a className="sprite sprite-1" href="/projects/editor/?tip_bar=getStarted">
<img
2015-09-11 09:43:10 -04:00
className="costume costume-1"
2016-01-25 08:30:10 -05:00
src="//cdn.scratch.mit.edu/scratchr2/static/images/cat-a.png"
alt="Scratch Cat" />
<img
2015-09-11 09:43:10 -04:00
className="costume costume-2"
2016-01-25 08:30:10 -05:00
src="//cdn.scratch.mit.edu/scratchr2/static/images/cat-b.png"
alt="Scratch Cat" />
2015-09-11 09:43:10 -04:00
<div className="circle"></div>
<div className="text">
{this.props.messages['intro.tryItOut']}
</div>
</a>
2015-09-11 09:43:10 -04:00
<a className="sprite sprite-2" href="/starter_projects/">
<img
2015-09-11 09:43:10 -04:00
className="costume costume-1"
2016-01-25 08:30:10 -05:00
src="//cdn.scratch.mit.edu/scratchr2/static/images/tera-a.png"
alt="Tera" />
<img
2015-09-11 09:43:10 -04:00
className="costume costume-2"
2016-01-25 08:30:10 -05:00
src="//cdn.scratch.mit.edu/scratchr2/static/images/tera-b.png"
alt="Tera" />
2015-09-11 09:43:10 -04:00
<div className="circle"></div>
<div className="text">
{this.props.messages['intro.seeExamples']}
</div>
</a>
<a className="sprite sprite-3" href="#" onClick={this.handleJoinClick}>
<img
2015-09-11 09:43:10 -04:00
className="costume costume-1"
2016-01-25 08:30:10 -05:00
src="//cdn.scratch.mit.edu/scratchr2/static/images/gobo-a.png"
alt="Gobo" />
<img
2015-09-11 09:43:10 -04:00
className="costume costume-2"
2016-01-25 08:30:10 -05:00
src="//cdn.scratch.mit.edu/scratchr2/static/images/gobo-b.png"
alt="Gobo" />
2015-09-11 09:43:10 -04:00
<div className="circle"></div>
<div className="text">
{this.props.messages['intro.joinScratch']}
</div>
2015-09-11 09:43:10 -04:00
<div className="text subtext">( it&rsquo;s free )</div>
</a>
<Registration key="registration"
isOpen={this.state.registrationOpen}
onRequestClose={this.closeRegistration}
onRegistrationDone={this.completeRegistration} />
</div>
<div className="description"
dangerouslySetInnerHTML={{__html: this.props.messages['intro.description']}}></div>
2015-09-11 09:43:10 -04:00
<div className="links">
<a href="/about/">
{this.props.messages['intro.aboutScratch']}
</a>
<a href="/educators/">
{this.props.messages['intro.forEducators']}
</a>
<a className="last" href="/parents/">
{this.props.messages['intro.forParents']}
</a>
</div>
</div>
2015-09-11 09:43:10 -04:00
<div className="video">
<div className="play-button" onClick={this.showVideo}></div>
2016-01-25 09:07:55 -05:00
<img src="//cdn.scratch.mit.edu/scratchr2/static/images/hp-video-screenshot.png"
alt="Intro Video" />
</div>
<Modal
2015-10-20 19:35:19 -04:00
className="video-modal"
isOpen={this.state.videoOpen}
onRequestClose={this.closeVideo}
style={{content:frameProps}}>
2015-10-20 19:35:19 -04:00
<iframe
src="//player.vimeo.com/video/65583694?title=0&amp;byline=0&amp;portrait=0"
{...omit(frameProps, 'padding')} />
</Modal>
</div>
);
}
});
2016-03-18 11:51:22 -04:00
var mapStateToProps = function (state) {
return {
session: state.session
};
};
var ConnectedIntro = connect(mapStateToProps)(Intro);
module.exports = ConnectedIntro;