Make Login & Sign Up as modal layovers (#122)
* make Login & Sign Up as modal layovers * delete extra signupForm.js in original path * deleted extra comments
This commit is contained in:
parent
64be537db7
commit
96321ca767
8 changed files with 58 additions and 26 deletions
|
@ -1,21 +1,27 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { reduxForm } from 'redux-form';
|
import { reduxForm } from 'redux-form';
|
||||||
import { validateAndLoginUser } from '../actions';
|
import { validateAndLoginUser } from '../../User/actions';
|
||||||
import LoginForm from '../components/LoginForm';
|
import LoginForm from '../components/LoginForm';
|
||||||
// import GithubButton from '../components/GithubButton';
|
// import GithubButton from '../components/GithubButton';
|
||||||
import { Link } from 'react-router';
|
import { Link } from 'react-router';
|
||||||
|
|
||||||
|
|
||||||
function LoginView(props) {
|
class LoginView extends React.Component {
|
||||||
return (
|
componentDidMount() {
|
||||||
<div className="login">
|
this.refs.login.focus();
|
||||||
<h1>Login</h1>
|
}
|
||||||
<LoginForm {...props} />
|
|
||||||
{/* <h2 className="login__divider">Or</h2>
|
render() {
|
||||||
<GithubButton buttonText="Login with Github" /> */}
|
return (
|
||||||
<Link className="form__cancel-button" to="/">Cancel</Link>
|
<div className="login" ref="login" tabIndex="0">
|
||||||
</div>
|
<h1>Login</h1>
|
||||||
);
|
<LoginForm {...this.props} />
|
||||||
|
{/* <h2 className="login__divider">Or</h2>
|
||||||
|
<GithubButton buttonText="Login with Github" /> */}
|
||||||
|
<Link className="form__cancel-button" to="/">Cancel</Link>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapStateToProps(state) {
|
function mapStateToProps(state) {
|
|
@ -1,19 +1,25 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { bindActionCreators } from 'redux';
|
import { bindActionCreators } from 'redux';
|
||||||
import * as UserActions from '../actions';
|
import * as UserActions from '../../User/actions';
|
||||||
import { reduxForm } from 'redux-form';
|
import { reduxForm } from 'redux-form';
|
||||||
import SignupForm from '../components/SignupForm';
|
import SignupForm from '../components/SignupForm';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { Link } from 'react-router';
|
import { Link } from 'react-router';
|
||||||
|
|
||||||
function SignupView(props) {
|
class SignupView extends React.Component {
|
||||||
return (
|
componentDidMount() {
|
||||||
<div className="signup">
|
this.refs.signup.focus();
|
||||||
<h1>Sign Up</h1>
|
}
|
||||||
<SignupForm {...props} />
|
|
||||||
<Link to="/">Cancel</Link>
|
render() {
|
||||||
</div>
|
return (
|
||||||
);
|
<div className="signup" ref="signup" tabIndex="0">
|
||||||
|
<h1>Sign Up</h1>
|
||||||
|
<SignupForm {...this.props} />
|
||||||
|
<Link className="form__cancel-button" to="/">Cancel</Link>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapStateToProps(state) {
|
function mapStateToProps(state) {
|
|
@ -27,6 +27,8 @@ import SplitPane from 'react-split-pane';
|
||||||
import Overlay from '../../App/components/Overlay';
|
import Overlay from '../../App/components/Overlay';
|
||||||
import SketchList from '../components/SketchList';
|
import SketchList from '../components/SketchList';
|
||||||
import About from '../components/About';
|
import About from '../components/About';
|
||||||
|
import LoginView from '../components/LoginView';
|
||||||
|
import SignupView from '../components/SignupView';
|
||||||
|
|
||||||
class IDEView extends React.Component {
|
class IDEView extends React.Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
|
@ -391,6 +393,24 @@ class IDEView extends React.Component {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
})()}
|
})()}
|
||||||
|
{(() => { // eslint-disable-line
|
||||||
|
if (this.props.location.pathname === '/login') {
|
||||||
|
return (
|
||||||
|
<Overlay>
|
||||||
|
<LoginView />
|
||||||
|
</Overlay>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
})()}
|
||||||
|
{(() => { // eslint-disable-line
|
||||||
|
if (this.props.location.pathname === '/signup') {
|
||||||
|
return (
|
||||||
|
<Overlay>
|
||||||
|
<SignupView />
|
||||||
|
</Overlay>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
})()}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
|
@ -3,8 +3,6 @@ import React from 'react';
|
||||||
import App from './modules/App/App';
|
import App from './modules/App/App';
|
||||||
import IDEView from './modules/IDE/pages/IDEView';
|
import IDEView from './modules/IDE/pages/IDEView';
|
||||||
import FullView from './modules/IDE/pages/FullView';
|
import FullView from './modules/IDE/pages/FullView';
|
||||||
import LoginView from './modules/User/pages/LoginView';
|
|
||||||
import SignupView from './modules/User/pages/SignupView';
|
|
||||||
// import SketchListView from './modules/Sketch/pages/SketchListView';
|
// import SketchListView from './modules/Sketch/pages/SketchListView';
|
||||||
import { getUser } from './modules/User/actions';
|
import { getUser } from './modules/User/actions';
|
||||||
|
|
||||||
|
@ -16,8 +14,8 @@ const routes = (store) =>
|
||||||
(
|
(
|
||||||
<Route path="/" component={App}>
|
<Route path="/" component={App}>
|
||||||
<IndexRoute component={IDEView} onEnter={checkAuth(store)} />
|
<IndexRoute component={IDEView} onEnter={checkAuth(store)} />
|
||||||
<Route path="/login" component={LoginView} />
|
<Route path="/login" component={IDEView} />
|
||||||
<Route path="/signup" component={SignupView} />
|
<Route path="/signup" component={IDEView} />
|
||||||
<Route path="/projects/:project_id" component={IDEView} />
|
<Route path="/projects/:project_id" component={IDEView} />
|
||||||
<Route path="/full/:project_id" component={FullView} />
|
<Route path="/full/:project_id" component={FullView} />
|
||||||
<Route path="/sketches" component={IDEView} />
|
<Route path="/sketches" component={IDEView} />
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
.login {
|
.login {
|
||||||
|
@extend %modal;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
height: 100%;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
padding: #{20 / $base-font-size}rem;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
.signup {
|
.signup {
|
||||||
|
@extend %modal;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
height: 100%;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
padding: #{20 / $base-font-size}rem;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue