mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-23 07:38:07 -05:00
Merge pull request #3054 from benjiwheeler/join-flow-modal-stub
introduce stub components for new scratch3 join modal
This commit is contained in:
commit
1684c67abf
4 changed files with 94 additions and 3 deletions
28
src/components/modal/join/modal.jsx
Normal file
28
src/components/modal/join/modal.jsx
Normal file
|
@ -0,0 +1,28 @@
|
|||
const PropTypes = require('prop-types');
|
||||
const React = require('react');
|
||||
const Modal = require('../base/modal.jsx');
|
||||
|
||||
require('./modal.scss');
|
||||
|
||||
const JoinModal = ({
|
||||
isOpen,
|
||||
onCompleteRegistration, // eslint-disable-line no-unused-vars
|
||||
onRequestClose,
|
||||
...modalProps
|
||||
}) => (
|
||||
<Modal
|
||||
useStandardSizes
|
||||
className="mod-join"
|
||||
isOpen={isOpen}
|
||||
onRequestClose={onRequestClose}
|
||||
{...modalProps}
|
||||
/>
|
||||
);
|
||||
|
||||
JoinModal.propTypes = {
|
||||
isOpen: PropTypes.bool,
|
||||
onCompleteRegistration: PropTypes.func,
|
||||
onRequestClose: PropTypes.func
|
||||
};
|
||||
|
||||
module.exports = JoinModal;
|
5
src/components/modal/join/modal.scss
Normal file
5
src/components/modal/join/modal.scss
Normal file
|
@ -0,0 +1,5 @@
|
|||
@import "../../../colors";
|
||||
@import "../../../frameless";
|
||||
|
||||
.mod-join {
|
||||
}
|
|
@ -18,10 +18,13 @@ const LoginDropdown = require('../../login/login-dropdown.jsx');
|
|||
const CanceledDeletionModal = require('../../login/canceled-deletion-modal.jsx');
|
||||
const NavigationBox = require('../base/navigation.jsx');
|
||||
const Registration = require('../../registration/registration.jsx');
|
||||
const Scratch3Registration = require('../../registration/scratch3-registration.jsx');
|
||||
const AccountNav = require('./accountnav.jsx');
|
||||
|
||||
require('./navigation.scss');
|
||||
|
||||
const USE_SCRATCH3_REGISTRATION = false;
|
||||
|
||||
class Navigation extends React.Component {
|
||||
constructor (props) {
|
||||
super(props);
|
||||
|
@ -195,9 +198,17 @@ class Navigation extends React.Component {
|
|||
<FormattedMessage id="general.joinScratch" />
|
||||
</a>
|
||||
</li>,
|
||||
<Registration
|
||||
key="registration"
|
||||
/>,
|
||||
(
|
||||
USE_SCRATCH3_REGISTRATION ? (
|
||||
<Scratch3Registration
|
||||
key="scratch3registration"
|
||||
/>
|
||||
) : (
|
||||
<Registration
|
||||
key="registration"
|
||||
/>
|
||||
)
|
||||
),
|
||||
<li
|
||||
className="link right login-item"
|
||||
key="login"
|
||||
|
|
47
src/components/registration/scratch3-registration.jsx
Normal file
47
src/components/registration/scratch3-registration.jsx
Normal file
|
@ -0,0 +1,47 @@
|
|||
const PropTypes = require('prop-types');
|
||||
const React = require('react');
|
||||
const connect = require('react-redux').connect;
|
||||
|
||||
const navigationActions = require('../../redux/navigation.js');
|
||||
const JoinModal = require('../modal/join/modal.jsx');
|
||||
|
||||
require('./registration.scss');
|
||||
|
||||
const Registration = ({
|
||||
handleCloseRegistration,
|
||||
handleCompleteRegistration,
|
||||
isOpen
|
||||
}) => (
|
||||
<div>
|
||||
<JoinModal
|
||||
isOpen={isOpen}
|
||||
key="join-modal"
|
||||
onCompleteRegistration={handleCompleteRegistration}
|
||||
onRequestClose={handleCloseRegistration}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
||||
Registration.propTypes = {
|
||||
handleCloseRegistration: PropTypes.func,
|
||||
handleCompleteRegistration: PropTypes.func,
|
||||
isOpen: PropTypes.bool
|
||||
};
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
isOpen: state.navigation.registrationOpen
|
||||
});
|
||||
|
||||
const mapDispatchToProps = dispatch => ({
|
||||
handleCloseRegistration: () => {
|
||||
dispatch(navigationActions.setRegistrationOpen(false));
|
||||
},
|
||||
handleCompleteRegistration: () => {
|
||||
dispatch(navigationActions.handleCompleteRegistration());
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(Registration);
|
Loading…
Reference in a new issue