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": "/",
"paths": [
"/accounts/",
"/accounts/",
"/csrf_token/",
"/fragment/",
"/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 "../../mixins";
.intro {
display: flex;
@ -224,22 +225,5 @@
}
.video-modal {
$video-width: 570px;
$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;
}
@include modal-iframe(570px, 357px, 15px);
}

View file

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