diff --git a/src/authn-component/index.jsx b/src/authn-component/index.jsx new file mode 100644 index 00000000..4f3bea6a --- /dev/null +++ b/src/authn-component/index.jsx @@ -0,0 +1,29 @@ +import React from 'react'; + +import PropTypes from 'prop-types'; + +import BaseContainer from '../base-container'; + +/** + * Main component that holds the logic for conditionally rendering login or registration form. + * + * @param {boolean} open - Required. Whether to open the modal window containing login or registration form. + * @param {function} setOpen - Required. Is used to toggle the modal window's open flag. + * + * @returns {JSX.Element} The rendered BaseContainer component containing either login or registration form. + */ + +const AuthnComponent = ({ + open, setOpen, +}) => ( + +
Login form
+
+); + +AuthnComponent.propTypes = { + open: PropTypes.bool.isRequired, + setOpen: PropTypes.func.isRequired, +}; + +export default AuthnComponent; diff --git a/src/base-container/index.jsx b/src/base-container/index.jsx new file mode 100644 index 00000000..5bd3d425 --- /dev/null +++ b/src/base-container/index.jsx @@ -0,0 +1,60 @@ +import React from 'react'; + +import { ModalDialog } from '@openedx/paragon'; +import PropTypes from 'prop-types'; + +import './index.scss'; + +/** + * Base component for registration or login form modals. + * + * @param {boolean} open - Required. Whether to open the modal window. + * @param {function} setOpen - Required. Is used to toggle the modal window's open flag. + * @param {string} footerText - Optional. The text for the modal footer. + * @param {React.node} children - Required. The login or registration form. + * + * @returns {JSX.Element} The rendered login or registration form modal. + */ + +const BaseContainer = ({ + children, footerText, open, setOpen, +}) => ( + + +
+
+ {children} +
+
+
+
+
+ + {footerText && ( + +

{footerText}

+
+ )} + + +); + +BaseContainer.propTypes = { + children: PropTypes.node.isRequired, + footerText: PropTypes.string, + open: PropTypes.bool.isRequired, + setOpen: PropTypes.func.isRequired, +}; + +BaseContainer.defaultProps = { + footerText: '', +}; + +export default BaseContainer; diff --git a/src/base-container/index.scss b/src/base-container/index.scss new file mode 100644 index 00000000..f18cf178 --- /dev/null +++ b/src/base-container/index.scss @@ -0,0 +1,18 @@ +@import "@edx/brand/paragon/variables"; + +.modal-body-container .pgn__modal-body-content { + height: 100%; +} + +// This class is related to close button of modal +.pgn__modal-close-container { + background: $white; + border-radius: 50%; + border: 2px solid $light-500; +} + +.pgn__modal-close-container .btn-icon__icon-container { + color: $light-700; +} + +