p5.js-web-editor/client/modules/App/App.jsx
Yining Shi acad9538cc Taking login and sign pages out + new design for login and signup page (#228)
* make login a seperate page

* make signup a another page

* get previousPath

* setPreviousPath between routes

* new desig for login pagen

* new design for signup page

* added login and exit icons

* added signup and exit icons

* refactor form-container.scss

* deleted extra code
2016-12-15 18:43:58 -05:00

40 lines
1 KiB
JavaScript

import React, { PropTypes } from 'react';
import { connect } from 'react-redux';
import DevTools from './components/DevTools';
import { setPreviousPath } from '../IDE/actions/ide';
class App extends React.Component {
constructor(props, context) {
super(props, context);
this.state = { isMounted: false };
}
componentDidMount() {
this.setState({ isMounted: true }); // eslint-disable-line react/no-did-mount-set-state
}
componentWillReceiveProps(nextProps) {
if (nextProps.location !== this.props.location) {
this.props.setPreviousPath(this.props.location.pathname);
}
}
render() {
return (
<div className="app">
{this.state.isMounted && !window.devToolsExtension && process.env.NODE_ENV === 'development' && <DevTools />}
{this.props.children}
</div>
);
}
}
App.propTypes = {
children: PropTypes.object,
location: PropTypes.shape({
pathname: PropTypes.string
}),
setPreviousPath: PropTypes.func.isRequired,
};
export default connect(() => ({}), { setPreviousPath })(App);