Add standalone legacy registration iframe

This commit is contained in:
Ray Schamp 2015-10-08 16:19:34 -06:00
parent 0884294516
commit 6b1ce8549e
6 changed files with 70 additions and 22 deletions

View file

@ -2,11 +2,12 @@
{ {
"root": "/", "root": "/",
"paths": [ "paths": [
"/accounts/",
"/accounts/", "/accounts/",
"/csrf_token/", "/csrf_token/",
"/fragment/",
"/get_image/", "/get_image/",
"/session/" "/session/",
"/static/"
] ]
} }
] ]

19
src/_mixins.scss Normal file
View file

@ -0,0 +1,19 @@
@mixin modal-iframe($iframe-width, $iframe-height, $padding: 0) {
&.ReactModal__Content {
top: 50%;
right: auto;
bottom: auto;
left: 50%;
margin-top: -($iframe-height + $padding * 2)/2;
margin-left: -($iframe-width + $padding * 2)/2;
padding: $padding;
width: $iframe-width;
height: $iframe-height;
iframe {
border: 0;
width: $iframe-width;
height: $iframe-height;
}
}
}

View file

@ -1,4 +1,5 @@
@import "../../colors"; @import "../../colors";
@import "../../mixins";
.intro { .intro {
display: flex; display: flex;
@ -224,22 +225,5 @@
} }
.video-modal { .video-modal {
$video-width: 570px; @include modal-iframe(570px, 357px, 15px);
$video-height: 357px;
$padding: 15px;
top: 50%;
right: auto;
bottom: auto;
left: 50%;
margin-top: -($video-height + $padding * 2)/2;
margin-left: -($video-width + $padding * 2)/2;
padding: $padding;
width: $video-width;
height: $video-height;
iframe {
border: 0;
width: $video-width;
height: $video-height;
}
} }

View file

@ -11,6 +11,7 @@ var Avatar = require('../avatar/avatar.jsx');
var Dropdown = require('./dropdown.jsx'); var Dropdown = require('./dropdown.jsx');
var Input = require('../forms/input.jsx'); var Input = require('../forms/input.jsx');
var Login = require('../login/login.jsx'); var Login = require('../login/login.jsx');
var Registration = require('../registration/registration.jsx');
require('./navigation.scss'); require('./navigation.scss');
@ -22,9 +23,10 @@ var Navigation = React.createClass({
], ],
getInitialState: function () { getInitialState: function () {
return { return {
'accountNavOpen': false,
'loginOpen': false, 'loginOpen': false,
'loginError': null, 'loginError': null,
'accountNavOpen': false 'registrationOpen': false
}; };
}, },
componentDidUpdate: function (prevProps, prevState) { componentDidUpdate: function (prevProps, prevState) {
@ -39,6 +41,10 @@ var Navigation = React.createClass({
if (!this.state.session.user) return; if (!this.state.session.user) return;
return '/users/' + this.state.session.user.username + '/'; return '/users/' + this.state.session.user.username + '/';
}, },
handleJoinClick: function (e) {
e.preventDefault();
this.setState({'registrationOpen': true});
},
handleLoginClick: function (e) { handleLoginClick: function (e) {
e.preventDefault(); e.preventDefault();
this.setState({'loginOpen': !this.state.loginOpen}); this.setState({'loginOpen': !this.state.loginOpen});
@ -87,6 +93,9 @@ var Navigation = React.createClass({
closeAccountNav: function () { closeAccountNav: function () {
this.setState({'accountNavOpen': false}); this.setState({'accountNavOpen': false});
}, },
closeRegistration: function () {
this.setState({'registrationOpen': false});
},
render: function () { render: function () {
var classes = classNames({ var classes = classNames({
'inner': true, 'inner': true,
@ -136,7 +145,13 @@ var Navigation = React.createClass({
</Dropdown> </Dropdown>
</li> </li>
] : [ ] : [
<li className="link right join" key="join"><a href="/join">Join Scratch</a></li>, <li className="link right join" key="join">
<a href="#" onClick={this.handleJoinClick}>Join Scratch</a>
</li>,
<Registration
key="registration"
isOpen={this.state.registrationOpen}
onRequestClose={this.closeRegistration} />,
<li className="link right login-item" key="login"> <li className="link right login-item" key="login">
<a <a
href="#" href="#"

View file

@ -0,0 +1,23 @@
var React = require('react');
var Modal = require('../modal/modal.jsx');
require('./registration.scss');
Modal.setAppElement(document.getElementById('view'));
module.exports = React.createClass({
propTypes: {
isOpen: React.PropTypes.func,
onRequestClose: React.PropTypes.func
},
render: function () {
return (
<Modal
isOpen={this.props.isOpen}
onRequestClose={this.props.onRequestClose}
className="registration">
<iframe src="/accounts/standalone-registration/" />
</Modal>
);
}
});

View file

@ -0,0 +1,6 @@
@import "../../mixins";
.registration {
@include modal-iframe(586px, 438px);
overflow: hidden;
}